Documentation
¶
Overview ¶
Package engine holds what one komando call is: who makes it and the state of its approvals. Today the CLI makes one call per process; the Mac and iPhone apps will run many calls in one process, for a person and for an agent at the same time, so nothing here reads the environment or a global by itself: the caller hands it in.
Index ¶
- Constants
- Variables
- func AgentName(lookup func(string) (string, bool)) string
- func AgentVars() []string
- type Caller
- type Kind
- type Session
- func (s *Session) Allowed() bool
- func (s *Session) ApproveSafety(what string)
- func (s *Session) ConfirmDanger(key string)
- func (s *Session) DangerConfirmed(key string) bool
- func (s *Session) GaveUp() bool
- func (s *Session) Lock()
- func (s *Session) MarkShown(what string)
- func (s *Session) PersonSaidNo() bool
- func (s *Session) SafetyApproved(what string) bool
- func (s *Session) SaidNo(no bool)
- func (s *Session) SetAllowed(allowed bool)
- func (s *Session) SetAsked(allowed bool)
- func (s *Session) SetGaveUp(g bool)
- func (s *Session) SetUnshown(why string)
- func (s *Session) SetWhy(why string)
- func (s *Session) Shown(what string) bool
- func (s *Session) Unlock()
- func (s *Session) Window() Window
- type Window
Constants ¶
const GateEnv = "KOMANDO_SSH_GATE"
GateEnv names the ssh-gate key a command came through.
Variables ¶
var GateLabel = regexp.MustCompile(`^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$`)
GateLabel is what an ssh-gate key's name may look like.
Functions ¶
Types ¶
type Caller ¶
type Caller struct {
Kind Kind
Agent string // the agent's name, for the approval window and the audit log
Actor string // who the audit log names (KOMANDO_ACTOR, else the account)
}
Caller is who makes a call.
func CallerFrom ¶
CallerFrom is the caller an environment lookup describes. terminal says whether a person could answer at a terminal (stdin and stderr are one).
type Session ¶
type Session struct {
// contains filtered or unexported fields
}
Session is the state of one call's approvals: what a person allowed in a window, what they confirmed at a terminal. One answer covers the call, so a call that passes two checks asks once; the next call asks again.
func (*Session) ApproveSafety ¶
func (*Session) ConfirmDanger ¶
func (*Session) DangerConfirmed ¶
DangerConfirmed and its setter: a destructive action a person confirmed by typing its name.
func (*Session) Lock ¶
func (s *Session) Lock()
Lock and Unlock guard a check that reads and then sets the window state.
func (*Session) PersonSaidNo ¶
PersonSaidNo and its setter: a person answered no at a terminal, so the stop that follows is their decision, not something to retry.
func (*Session) SafetyApproved ¶
SafetyApproved and its setter: a safety change a person allowed.