Documentation
¶
Overview ¶
Package sshgate is the SSH channel: agents reach the machines Beacon knows with the tools they already use (ssh, scp, sftp, rsync, port forwarding) or with the MCP and REST tools, and never hold a key. Beacon signs a certificate valid for a few minutes for every connection to a machine, which trusts only Beacon's certificate authority, and records every session: asciicast v3 for replay, and a transcript that breaks an interactive shell into commands with their exit status.
It does not judge what runs. Reviewing commands is the agents' business, done by their own harness; people see every session, echoed to the alert chat, and can pause the channel.
Index ¶
- Constants
- Variables
- func RanBy(actor, who string) bool
- func TrustOneAccount(user, redirect string) string
- type Actor
- type Added
- type Command
- type ConnectorSetup
- type Deps
- type DirFiles
- func (d DirFiles) Create(name string) (io.WriteCloser, error)
- func (d DirFiles) CreateStaged(name string) (filecapture.Capture, error)
- func (d DirFiles) Open(name string) (io.ReadCloser, error)
- func (d DirFiles) ReadFile(name string) ([]byte, error)
- func (d DirFiles) Remove(name string) error
- func (d DirFiles) WriteFile(name string, b []byte) error
- type EditInput
- type FileView
- type Files
- type Gate
- func (g *Gate) Add(ctx context.Context, who Actor, in MachineInput) (Added, error)
- func (g *Gate) CAPublicKey() string
- func (g *Gate) CheckSSH(ctx context.Context, who Actor, machine, registration string) (SSHCheck, error)
- func (g *Gate) ConnectionConfig(who Actor, address, machine string) (config, knownHosts string)
- func (g *Gate) EditFile(ctx context.Context, who Actor, machine string, in EditInput) (Written, error)
- func (g *Gate) HostKey() string
- func (g *Gate) InteractiveShell(ctx context.Context, who Actor, machineName string, ioStreams ShellIO) (Transcript, error)
- func (g *Gate) List(who Actor, address string) (Machines, error)
- func (g *Gate) MachineHistory(name string, before int64, limit int) (store.MachineHistory, error)
- func (g *Gate) Paused() bool
- func (g *Gate) PausedSince() time.Time
- func (g *Gate) PublicAddress() string
- func (g *Gate) ReadFile(ctx context.Context, who Actor, machine, path string, offset, limit int) (FileView, error)
- func (g *Gate) Recheck() int
- func (g *Gate) Recording(id string) (io.ReadCloser, error)
- func (g *Gate) RecordingFor(p store.Principal, id string) (io.ReadCloser, error)
- func (g *Gate) Remove(ctx context.Context, who Actor, name string) error
- func (g *Gate) RestoreMachine(ctx context.Context, who Actor, name string, in MachineRestore) (MachineView, error)
- func (g *Gate) Run(ctx context.Context, who Actor, machine string, in RunInput) (RunResult, error)
- func (g *Gate) RunPending(ctx context.Context)
- func (g *Gate) SearchFiles(ctx context.Context, who Actor, machine string, in SearchInput) (SearchResult, error)
- func (g *Gate) Serve(ctx context.Context, ln net.Listener) error
- func (g *Gate) Session(id string) (Transcript, error)
- func (g *Gate) SessionDetail(ctx context.Context, id string) (Transcript, error)
- func (g *Gate) SessionDetailFor(ctx context.Context, p store.Principal, id string) (Transcript, error)
- func (g *Gate) SessionFor(p store.Principal, id string) (Transcript, error)
- func (g *Gate) Sessions(f SessionFilter) ([]SessionView, error)
- func (g *Gate) SessionsFor(p store.Principal, f SessionFilter) ([]SessionView, error)
- func (g *Gate) SetConnector(ctx context.Context, who Actor, name, key string) (MachineView, error)
- func (g *Gate) SetLeader(fn func() bool)
- func (g *Gate) SetPaused(ctx context.Context, who Actor, paused bool) error
- func (g *Gate) Tidy(ctx context.Context)
- func (g *Gate) TidyMachineAccess() int
- func (g *Gate) Update(ctx context.Context, who Actor, name string, in MachineUpdate) (MachineView, error)
- func (g *Gate) UpdateSettings(publicAddr string, sourceAddrs []string, keep time.Duration, lang i18n.Lang, ...)
- func (g *Gate) WriteFile(ctx context.Context, who Actor, machine, path, content string) (Written, error)
- type MachineInput
- type MachineRestore
- type MachineUpdate
- type MachineView
- type Machines
- type Poster
- type RunInput
- type RunResult
- type SSHCheck
- type SSHCheckStatus
- type SearchInput
- type SearchMatch
- type SearchResult
- type SessionFilter
- type SessionView
- type ShellEvent
- type ShellIO
- type Transcript
- type Written
Constants ¶
const PauseKey = "ssh_paused"
PauseKey is where the start of a pause is stored; zero when the channel runs.
const PersonalConfigPath = "~/.ssh/beacon-personal.conf"
PersonalConfigPath is the dedicated OpenSSH configuration file for the console's personal connection.
Variables ¶
var ( ErrDisabled = errors.New("the SSH channel is not configured") ErrPaused = errors.New("agents' access to machines is paused") ErrStandby = errors.New("this instance is the standby; tools run on the primary") ErrNoMachine = errors.New("no such machine") ErrForbidden = errors.New("this agent may not reach the machine") ErrUnreachable = errors.New("the machine cannot be reached") ErrExists = errors.New("a machine with this name exists") ErrBadInput = errors.New("bad input") ErrNoFile = errors.New("no such file") ErrNotRegular = errors.New("not a regular file") ErrBinary = errors.New("the file is binary") ErrTooLarge = errors.New("the file is too large") ErrChanged = errors.New("the file changed since it was read") ErrNoMatch = errors.New("old_string is not in the file") ErrAmbiguous = errors.New("old_string occurs more than once") ErrNoSession = errors.New("no such session") ErrRecordingLimit = errors.New("the session reached its recording limit and Beacon closed it") ErrRecordingFailed = errors.New("the session's recording could not be written, and Beacon closed it") )
Errors the API and MCP turn into answers. They are wrapped with details.
var ( ErrMachineChanged = errors.New("machine settings changed; reload the current version and try again") ErrMachineVersion = errors.New("no such version in this machine's current registration") )
var ErrAlias = errors.New("another machine has this address or host key")
ErrAlias is the answer for a machine that would be another machine's second record.
var ErrDisconnected = errors.New("the machine's connector is not connected; it connects out to the channel with ssh -R")
ErrDisconnected is the answer for a connector machine whose connection is not up.
ErrRecordingUnavailable identifies a visible session that cannot currently be replayed.
var ErrResumeByPerson = errors.New("only a person, or beacon ssh resume on the host, resumes SSH access")
ErrResumeByPerson is the answer to an agent or a token that asks to resume the channel.
ErrSSHCheckUnavailable means Beacon could not prepare the certificate or persist its audit.
ErrSearchUnavailable means the enrolled machine lacks the standard shell utilities for search.
Functions ¶
func RanBy ¶
RanBy reports whether a session's actor (as the audit log names it) is who: the whole name, or the person or the agent of "person / agent".
func TrustOneAccount ¶
TrustOneAccount is the shell line that has the machine's sshd trust Beacon's certificate authority for the one account Beacon signs in as, and for no other (root included), appending (>>) or writing (>) sshd's drop-in file. A change of the account in Beacon then takes this line run again on the machine.
Types ¶
type Actor ¶
type Actor struct {
Name string
Via string
Key string
Cred string // the credential it came with: token:NAME, grant:ID or key:FINGERPRINT; none for the console and the command line
}
Actor is who uses the channel: Name as the audit log names it (a person, "person / agent", or a token's name), how (ssh, mcp, api, console or cli), and Key, the principal (store.Principal.Key) whose access is checked afresh each time; none for the command line.
type Added ¶
type Added struct {
Machine MachineView `json:"machine"`
// TrustedUserCAKey is the line for the machine's TrustedUserCAKeys file.
TrustedUserCAKey string `json:"trusted_user_ca_key"`
// Connector is the machine-side setup of a machine behind NAT; nil for a machine Beacon dials.
Connector *ConnectorSetup `json:"connector,omitempty"`
}
Added is a machine just added, with what it needs before agents can use it.
type Command ¶
type Command struct {
Command string `json:"command"`
Inputs []string `json:"inputs,omitempty"`
Output string `json:"output"`
Exit *int `json:"exit,omitempty"`
Started time.Time `json:"started"`
Ms int64 `json:"ms"`
}
Command is one command run at an interactive shell's prompt, as the shell-integration marks delimit it. Inputs are the lines typed into the program while it ran (into psql, say).
type ConnectorSetup ¶
type ConnectorSetup struct {
// KnownHosts is the line for the machine's known_hosts file: the channel's host key at its public address.
KnownHosts string `json:"known_hosts"`
// Command is the ssh command that connects out; Unit is a systemd unit that keeps it running.
Command string `json:"command"`
Unit string `json:"unit"`
// Script does it all, as root on the machine: the certificate authority, the account, the known_hosts
// line, the connector's key and user, the unit.
Script string `json:"script"`
// HostKeyPending says the machine's host key is not pinned yet: Beacon learns it when the connector
// first connects, and says so in the audit log and the chat.
HostKeyPending bool `json:"host_key_pending,omitempty"`
}
ConnectorSetup is what a machine behind NAT needs on its side, as machine add prints it.
type Deps ¶
type Deps struct {
Store *store.Store
HostKey ssh.Signer // the channel's own host key, which agents' ssh clients pin
CA ssh.Signer // signs the certificates machines accept
// SourceAddresses, when set, go into every certificate as its source-address option (CIDRs), so a
// certificate works only from Beacon's own addresses.
SourceAddresses []string
Dir string // where recordings and transcripts are kept (Files' default)
Keep time.Duration // how long sessions are kept
// Files is where recordings and transcripts are kept: DirFiles under Dir (the default), or an
// S3-compatible bucket an HA pair shares (ssh.recordings: s3 in the configuration).
Files Files
Bot Poster
Lang i18n.Lang
Metrics *metrics.Metrics
Log *slog.Logger
Now func() time.Time
// Dial connects to machines; nil uses a net.Dialer. Tests replace it.
Dial func(ctx context.Context, network, addr string) (net.Conn, error)
// LocalMachines lets whoever may add a machine add one at a loopback or link-local address, as
// beacon on the host may (machine_writes.go). Tests whose machines listen on loopback set it; the
// service never does.
LocalMachines bool
// PublicAddress (host:port) is where agents and connector machines reach the channel; it goes into
// the setup machine add prints for a machine behind NAT. May be empty.
PublicAddress string
// Pages builds the signed links to sessions' pages, where people replay them; nil: no links.
Pages *link.Pages
// Leader reports whether this instance holds the HA lease. Nil means always leader (no HA).
Leader func() bool
}
Deps are what the channel needs. Bot and Metrics may be nil.
type DirFiles ¶
type DirFiles struct {
Dir string
}
DirFiles keeps recordings under one directory, the default (the data directory's recordings tree). The day's directories are made as needed, and removed when a prune empties them.
func (DirFiles) Create ¶
func (d DirFiles) Create(name string) (io.WriteCloser, error)
Create implements Files.
func (DirFiles) CreateStaged ¶
func (d DirFiles) CreateStaged(name string) (filecapture.Capture, error)
CreateStaged reserves a capture which becomes readable under name on Close.
func (DirFiles) Open ¶
func (d DirFiles) Open(name string) (io.ReadCloser, error)
Open implements Files.
type EditInput ¶
type EditInput struct {
Path string `json:"path"`
OldString string `json:"old_string"`
NewString string `json:"new_string"`
ReplaceAll bool `json:"replace_all,omitempty"`
}
EditInput replaces OldString with NewString in a file: exactly one occurrence, or every one with ReplaceAll.
type FileView ¶
type FileView struct {
Machine string `json:"machine"`
Path string `json:"path"`
Content string `json:"content"`
Offset int `json:"offset"`
Lines int `json:"lines"`
TotalLines int `json:"total_lines"`
More bool `json:"more,omitempty"` // lines follow the last one shown
Session string `json:"session"`
RecordingState store.EvidenceState `json:"recording_state,omitempty"`
TranscriptState store.EvidenceState `json:"transcript_state,omitempty"`
}
FileView is part of a file, as an agent's own read tool shows it: each line numbered, a tab, the line.
type Files ¶
type Files interface {
// Create makes the file and returns its writer. A recording's name is its session's id, so a
// file of that name is not expected to exist.
Create(name string) (io.WriteCloser, error)
// WriteFile stores b under the name in one piece (a transcript).
WriteFile(name string, b []byte) error
// ReadFile returns what WriteFile stored.
ReadFile(name string) ([]byte, error)
// Open streams what is under the name (a recording's replay).
Open(name string) (io.ReadCloser, error)
// Remove deletes the file.
Remove(name string) error
}
Files is one recordings store. A file that is not there reads as an error naming it; removing one that is not there is no error.
type Gate ¶
type Gate struct {
// contains filtered or unexported fields
}
Gate is the SSH channel.
func (*Gate) CAPublicKey ¶
CAPublicKey is the line machines put in their TrustedUserCAKeys file.
func (*Gate) CheckSSH ¶
func (g *Gate) CheckSSH(ctx context.Context, who Actor, machine, registration string) (SSHCheck, error)
CheckSSH checks a single enrolled machine through the ordinary SSH authorization and pause policy. A nonempty registration binds the console form to the page that offered the check.
func (*Gate) ConnectionConfig ¶
ConnectionConfig returns a personal connection's SSH configuration and the channel's public host key.
func (*Gate) EditFile ¶
func (g *Gate) EditFile(ctx context.Context, who Actor, machine string, in EditInput) (Written, error)
EditFile edits a text file by exact replacement, as an agent's own edit tool does. It fails rather than overwrite a file that changed after it was read.
func (*Gate) InteractiveShell ¶
func (g *Gate) InteractiveShell(ctx context.Context, who Actor, machineName string, ioStreams ShellIO) (Transcript, error)
InteractiveShell opens a CA-certified PTY shell on machineName for who, recording asciicast v3 replay and OSC 133 command transcripts identically to direct SSH sessions, and immediately revoking the session if access ends or the channel is paused.
func (*Gate) List ¶
List returns the machines. address is where agents reach the channel (host:port), for the ssh configuration; it may be empty.
func (*Gate) MachineHistory ¶
MachineHistory returns the current registration's metadata versions, newest first.
func (*Gate) PausedSince ¶
PausedSince is when the pause started; zero while the channel runs.
func (*Gate) PublicAddress ¶
PublicAddress returns the configured external host:port of the SSH channel.
func (*Gate) ReadFile ¶
func (g *Gate) ReadFile(ctx context.Context, who Actor, machine, path string, offset, limit int) (FileView, error)
ReadFile reads lines of a text file, from line offset (1 is the first), at most limit (default 2000). Lines longer than 2000 characters are cut.
func (*Gate) Recheck ¶
Recheck closes at once what is open on the channel (connections and tool calls) for whoever may no longer reach its machine: a token revoked or expired, an agent deleted or given fewer machines or a weaker preset, an OAuth grant revoked, an account disabled or demoted so that its agents lose machines:ssh, a key removed; and on a machine that is gone or no longer the one it was opened on (added again, another account, address or host key). Beacon calls it after each such change, and every minute (Tidy) for what expired. It reports how many it closed.
func (*Gate) Recording ¶
func (g *Gate) Recording(id string) (io.ReadCloser, error)
Recording opens a session's recording (asciicast v3) for a trusted caller.
func (*Gate) RecordingFor ¶
RecordingFor opens a recording only when p may see this session's details.
func (*Gate) Remove ¶
Remove forgets a machine; its sessions stay on record. What is open on it closes, and a connector machine's connection too.
func (*Gate) RestoreMachine ¶
func (g *Gate) RestoreMachine(ctx context.Context, who Actor, name string, in MachineRestore) (MachineView, error)
RestoreMachine copies an earlier snapshot into a fresh version without changing identity fields.
func (*Gate) Run ¶
Run runs a command on a machine, as the machine's user, in a shell without a terminal.
func (*Gate) RunPending ¶
RunPending publishes sealed evidence when the files store supports it. Every instance runs the worker, including a standby which may have local evidence from an earlier term as primary.
func (*Gate) SearchFiles ¶
func (g *Gate) SearchFiles(ctx context.Context, who Actor, machine string, in SearchInput) (SearchResult, error)
SearchFiles searches a single authorised machine under its ordinary operating-system identity. The directory selects the search, without granting broader access than other file tools.
func (*Gate) Serve ¶
Serve answers SSH connections on ln until ln is closed or ctx ends: agents', whose user name is the machine they want, and connector machines', which sign in as themselves (connector.go). Ctx is this instance's hold on the channel: when it ends (the HA lease is lost, or Beacon stops), ln is closed, and so is everything open on the channel here, connections and tool calls alike, so that none outlives the pause switch, revocation and the checks every minute that the instance holding the lease runs.
func (*Gate) Session ¶
func (g *Gate) Session(id string) (Transcript, error)
Session returns a session's transcript for a trusted caller; an open session has only its record.
func (*Gate) SessionDetail ¶
SessionDetail verifies access to the replay for a caller who has already authorised the session.
func (*Gate) SessionDetailFor ¶
func (g *Gate) SessionDetailFor(ctx context.Context, p store.Principal, id string) (Transcript, error)
SessionDetailFor verifies the replay only after checking the caller's machine and session scope.
func (*Gate) SessionFor ¶
SessionFor returns a transcript only when p may see this session's details.
func (*Gate) Sessions ¶
func (g *Gate) Sessions(f SessionFilter) ([]SessionView, error)
Sessions lists sessions for a trusted caller, newest first.
func (*Gate) SessionsFor ¶
func (g *Gate) SessionsFor(p store.Principal, f SessionFilter) ([]SessionView, error)
SessionsFor lists sessions visible to p. The machine scope is applied before the result limit.
func (*Gate) SetConnector ¶
SetConnector sets or changes the key a connector machine connects out with. A connection signed in with the old key is closed.
func (*Gate) SetLeader ¶
SetLeader sets how the channel tells whether this instance holds the HA lease. main calls it after the lease exists; newGate runs earlier. Nil means always leader (no HA).
func (*Gate) SetPaused ¶
SetPaused pauses or resumes access. Pausing closes every open client connection and tool call; resuming takes a person or beacon on the host (mayResume).
func (*Gate) Tidy ¶
Tidy keeps the channel tidy until ctx ends: it forgets sessions older than Keep, with their files, and sends the chat what agents did.
func (*Gate) TidyMachineAccess ¶
TidyMachineAccess forgets the named machines whose access ended, on every credential and account, each in the audit log (store.TidyMachineAccess). Their access ended when the time came; Recheck closes what is open on them.
func (*Gate) Update ¶
func (g *Gate) Update(ctx context.Context, who Actor, name string, in MachineUpdate) (MachineView, error)
Update patches machine metadata and records any resulting revision.
type MachineInput ¶
type MachineInput struct {
Name string `json:"name"`
Address string `json:"address"`
User string `json:"user,omitempty"`
Critical bool `json:"critical,omitempty"`
Note string `json:"note,omitempty"`
Replace bool `json:"replace,omitempty"`
ConnectorKey string `json:"connector_key,omitempty"`
HostKey string `json:"host_key,omitempty"`
}
MachineInput adds a machine. Address is host or host:port (22 by default), or "connector" for a machine behind NAT that connects out to the channel itself; User defaults to beacon. Replace registers the machine again, pinning its host key again after it was reinstalled, say; like every other change of a machine it takes access to all machines (machine_writes.go). ConnectorKey is the public key a connector machine signs in with, and HostKey its sshd's host key, which Beacon otherwise learns the first time the machine connects; both are for connector machines only.
type MachineRestore ¶
type MachineUpdate ¶
type MachineUpdate = store.MachineMetadataUpdate
MachineUpdate changes only the restorable metadata. A nil field keeps the current value.
type MachineView ¶
type MachineView struct {
Name string `json:"name"`
Version int64 `json:"metadata_version"`
Registration string `json:"-"`
MonitorRegistration string `json:"registration,omitempty"`
Address string `json:"address"`
User string `json:"user"`
HostKey string `json:"host_key_fingerprint"`
Critical bool `json:"critical,omitempty"`
Note string `json:"note,omitempty"`
Added time.Time `json:"added"`
AddedBy string `json:"added_by,omitempty"`
// Reachable says whether the caller's token reaches it through the channel.
Reachable bool `json:"reachable"`
// Connector says the machine connects out to the channel itself (behind NAT); Connected and
// ConnectedSince say whether and since when it is connected right now. Both are left out for
// machines Beacon dials.
Connector bool `json:"connector,omitempty"`
Connected *bool `json:"connected,omitempty"`
ConnectedSince time.Time `json:"connected_since,omitzero"`
}
MachineView is a machine as the API shows it.
type Machines ¶
type Machines struct {
Machines []MachineView `json:"machines"`
// SSHConfig is an ssh_config(5) block for the machines the caller reaches, with the channel's host
// key for known_hosts; empty without Address.
SSHConfig string `json:"ssh_config,omitempty"`
KnownHosts string `json:"known_hosts,omitempty"`
}
Machines is the list of machines, and how the caller connects to them with its own ssh.
type RunInput ¶
type RunInput struct {
Command string `json:"command"`
Cwd string `json:"cwd,omitempty"`
Stdin string `json:"stdin,omitempty"`
Timeout int `json:"timeout,omitempty"`
}
RunInput runs a command. Timeout is in seconds (default 120, at most 600).
type RunResult ¶
type RunResult struct {
Machine string `json:"machine"`
ExitCode int `json:"exit_code"`
Stdout string `json:"stdout"`
Stderr string `json:"stderr"`
TimedOut bool `json:"timed_out,omitempty"`
Truncated bool `json:"truncated,omitempty"`
Ms int64 `json:"duration_ms"`
Session string `json:"session"`
RecordingState store.EvidenceState `json:"recording_state,omitempty"`
TranscriptState store.EvidenceState `json:"transcript_state,omitempty"`
}
RunResult is what a command did. ExitCode is -1 when it timed out.
type SSHCheck ¶
type SSHCheck struct {
ID string `json:"check_id"`
Machine string `json:"machine"`
Route string `json:"route"`
Status SSHCheckStatus `json:"status"`
CheckedAt time.Time `json:"checked_at"`
}
SSHCheck reports a point-in-time attempt by Beacon. Ready means the pinned key matched and the machine accepted Beacon's certificate. The check never asks the machine to open a session.
type SSHCheckStatus ¶
type SSHCheckStatus string
SSHCheckStatus describes which part of the machine handshake Beacon observed.
const ( SSHCheckReady SSHCheckStatus = "ready" SSHCheckDisconnected SSHCheckStatus = "connector_disconnected" SSHCheckConnectorBusy SSHCheckStatus = "connector_busy" SSHCheckForwardFailed SSHCheckStatus = "connector_forward_failed" SSHCheckUnreachable SSHCheckStatus = "unreachable" SSHCheckHostKeyMismatch SSHCheckStatus = "host_key_mismatch" SSHCheckHandshakeFailed SSHCheckStatus = "handshake_failed" SSHCheckAuthenticationIncomplete SSHCheckStatus = "authentication_incomplete" SSHCheckAuthenticationSkipped SSHCheckStatus = "authentication_skipped" SSHCheckTimedOut SSHCheckStatus = "timed_out" )
type SearchInput ¶
type SearchInput struct {
Directory string `json:"directory" jsonschema:"absolute physical project directory"`
Query string `json:"query" jsonschema:"literal case-sensitive text on one line"`
Limit int `json:"limit,omitempty" jsonschema:"maximum matches (default 25, maximum 50)"`
}
SearchInput asks for literal, case-sensitive matches in an explicit project directory.
type SearchMatch ¶
type SearchResult ¶
type SearchResult struct {
Machine string `json:"machine"`
Directory string `json:"directory"`
Matches []SearchMatch `json:"matches"`
ScannedFiles *int `json:"scanned_files,omitempty"`
Limited bool `json:"limited"`
TimedOut bool `json:"timed_out,omitempty"`
Session string `json:"session"`
RecordingState store.EvidenceState `json:"recording_state,omitempty"`
TranscriptState store.EvidenceState `json:"transcript_state,omitempty"`
}
type SessionFilter ¶
SessionFilter narrows a list of sessions. Agent matches who ran them: "person / agent", the agent or the person alone, or a token's name.
type SessionView ¶
type SessionView struct {
store.SessionRecord
Page string `json:"page,omitempty"`
}
SessionView is a session as the API and MCP list it: its record and the link to its page.
type ShellEvent ¶
ShellEvent carries terminal stdin bytes or a dynamic PTY window resize from an interactive client.
type ShellIO ¶
type ShellIO struct {
Cols, Rows int
OnStart func(sessionID string)
Output func(data []byte) error
Events <-chan ShellEvent
}
ShellIO connects an interactive terminal frontend (such as the console's WebSocket terminal) to a recorded, CA-certified PTY shell session on an enrolled machine.
type Transcript ¶
type Transcript struct {
store.SessionRecord
Stdin string `json:"stdin,omitempty"`
Stdout string `json:"stdout,omitempty"`
Stderr string `json:"stderr,omitempty"`
Commands []Command `json:"commands,omitempty"`
CommandsAdvisory bool `json:"commands_advisory,omitempty"`
Truncated bool `json:"truncated,omitempty"` // the recording or structured text exceeded its capture limit
Page string `json:"page,omitempty"`
RecordingAvailable *bool `json:"recording_available,omitempty"`
RecordingPublication string `json:"recording_publication,omitempty"`
TranscriptPublication string `json:"transcript_publication,omitempty"`
// contains filtered or unexported fields
}
Transcript is a session as an agent reads it back: the record, plus what a command was sent and printed (cleaned of terminal codes) or, for an interactive shell, each command with its output and exit status. A shell's commands are told apart by the shell-integration marks in its output, which any program the shell runs can print too, so CommandsAdvisory says they are a guide; the recording, with what was typed and the raw output, is the record. Page is the session's replay URL.
type Written ¶
type Written struct {
Machine string `json:"machine"`
Path string `json:"path"`
Bytes int `json:"bytes"`
Replacements int `json:"replacements,omitempty"`
Session string `json:"session"`
RecordingState store.EvidenceState `json:"recording_state,omitempty"`
TranscriptState store.EvidenceState `json:"transcript_state,omitempty"`
}
Written is what a write or an edit did.