Documentation
¶
Overview ¶
Package console serves the console sessions of a node.
The daemon listens on the console port and hands every connection it accepts to a process of its own, which does all the rest: the TLS handshake, the verification of the ticket, the websocket, and the command run in a terminal. The daemon never reads a byte of a session, and a session outlives it: a daemon restart does not interrupt the consoles.
Index ¶
Constants ¶
const DefaultPort = 1216
DefaultPort is the port the console listener listens on.
Variables ¶
This section is empty.
Functions ¶
func ServeInherited ¶
func ServeInherited() error
ServeInherited serves the console session of the connection the process inherited from the daemon.
Types ¶
type Config ¶
type Config struct {
// Hostname is the name of this node: a ticket for another node
// is relayed to it.
Hostname string
// Certificate is what the session authenticates the node to the
// client with.
Certificate tls.Certificate
// VerifyKey is the public key of the key the tickets are signed
// with.
VerifyKey *rsa.PublicKey
// TicketDir is where the used tickets are marked, and SessionDir
// where the sessions are recorded.
TicketDir string
SessionDir string
// Command returns the command a session runs in its terminal.
Command func(console.Target) ([]string, error)
// PeerURL returns the url of the console endpoint of a peer
// node, and PeerTLSConfig how to verify it.
PeerURL func(node string) (string, error)
PeerTLSConfig *tls.Config
// Authenticated is called once the ticket of the session is
// accepted, to tell the daemon the connection is no longer one
// of the unauthenticated connections it bounds the number of.
Authenticated func()
Log *plog.Logger
}
Config is what a session process needs of the node it runs on.
type Listener ¶
type Listener struct {
// contains filtered or unexported fields
}
Listener accepts the console connections and hands each of them to a session process of its own.
func NewListener ¶
NewListener returns the console listener of the address.
type Session ¶
type Session struct {
PID int `json:"pid"`
User string `json:"user"`
Remote string `json:"remote"`
Target console.Target `json:"console"`
StartedAt time.Time `json:"started_at"`
}
Session is what a console session records of itself for the time it lasts.
The record is a file, so it is there for whoever needs it after the daemon that spawned the session is gone: the sessions outlive it.