Keep step-up elevation for the signed-in session and stop gating terminals
The proxy forwards an HMAC-derived session id (X-Pipelines-Session) on /connect and POST /files; the server trusts it only on token-authenticated requests and keys elevation by it, so reconnects stay elevated up to a 24 h cap. Terminals rely on their su -l login. The app no longer forgets the elevation on disconnect and asks again only on a fresh refusal.
This commit is contained in:
@@ -1,11 +1,14 @@
|
||||
package protocol
|
||||
|
||||
// Step-up re-authentication. A signed-in web session can read everything, but
|
||||
// running shell commands, typing into a shell, changing or uploading files and
|
||||
// opening a terminal additionally need a recent password confirmation on the
|
||||
// same connection. The server verifies the password against the web sign-in
|
||||
// password file; the elevation lasts for a bounded time (15 minutes by
|
||||
// default) and ends with the connection.
|
||||
// running shell commands, typing into a shell and changing or uploading files
|
||||
// additionally need a password confirmation. (Terminals are not gated: each
|
||||
// one asks for the OS account password through `su -l`.) The server verifies
|
||||
// the password against the web sign-in password file. A confirmation belongs
|
||||
// to the web session the proxy reports (SessionHeader): every connection of
|
||||
// that session stays elevated until the session ends or a long cap (24 hours
|
||||
// by default) passes. A connection without a trusted session id elevates only
|
||||
// itself, until it closes.
|
||||
const (
|
||||
// Elevate confirms the sign-in password (Message.Password). The reply is
|
||||
// Elevated, or Error with Code ErrorElevationFailed or
|
||||
@@ -25,6 +28,11 @@ const (
|
||||
// ElevationHeader carries Elevation.Token on POST /files. A refused upload
|
||||
// answers 403 with a JSON body {"code":"elevation_required","error":...}.
|
||||
ElevationHeader = "X-Pipelines-Elevation"
|
||||
// SessionHeader carries the web proxy's opaque id of the signed-in web
|
||||
// session on /connect upgrades and POST /files: an HMAC of the session
|
||||
// token's generation and id, never the cookie. The server trusts it only
|
||||
// on a request authenticated with the shared server token.
|
||||
SessionHeader = "X-Pipelines-Session"
|
||||
)
|
||||
|
||||
// Elevation is the elevated reply body.
|
||||
@@ -33,7 +41,7 @@ type Elevation struct {
|
||||
// clients whose clock differs from the server's.
|
||||
ExpiresAt string `json:"expires_at"`
|
||||
Seconds int `json:"seconds"`
|
||||
// Token authorises HTTP uploads for as long as this connection stays
|
||||
// elevated. It is random, held only in memory and never logged.
|
||||
// Token authorises HTTP uploads for as long as this elevation lasts. It
|
||||
// is random, held only in memory and never logged.
|
||||
Token string `json:"token,omitempty"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user