Documentation
¶
Overview ¶
Package machines adds another machine to the session list (ADR-0024): it finds candidates, and it runs the one setup both `smif remote add` and the Machines screen use.
The password goes to ssh and sudo and nowhere else. The daemon never uses your own key: smif makes one that can only read sessions there.
Index ¶
Constants ¶
const ( CommandLinux = "sudo apt install -y openssh-server && sudo systemctl enable --now ssh" CommandMac = "sudo systemsetup -setremotelogin on" )
The command to run on a machine with ssh off. smif cannot do this from here.
const AskpassEnv = "SMIF_ASKPASS"
AskpassEnv marks a run of the smif binary as ssh's askpass helper.
Variables ¶
var ErrStopped = errors.New("stopped")
ErrStopped is a setup you stopped.
var Steps = []struct { ID Step Label string }{ {StepReach, "Reach ssh"}, {StepLogin, "Log in"}, {StepSystem, "Detect the system"}, {StepSmif, "Install smif"}, {StepKey, "Add a key that can only read sessions"}, {StepLinger, "Keep smif running after logout"}, {StepConfig, "Add it to your list"}, {StepDaemon, "Wait for your daemon to connect"}, }
Steps is the checklist in order.
Functions ¶
Types ¶
type Asker ¶
type Asker interface {
// Closed says ssh does not answer on that machine. The setup keeps trying.
Closed(name string)
// Login asks for a password. problem is why it asks again, or empty.
Login(user, problem string) (string, string, bool)
// Sudo asks for the sudo password. problem is why it asks again, or empty.
Sudo(problem string) (string, bool)
// Install asks to install smif on that machine.
Install() bool
}
Asker answers the questions only a person can. Each call blocks. False stops the setup, except Sudo, where false skips the step.
type Daemon ¶
type Daemon interface {
Reload() error
// Reached reports the daemon's last look at a host.
Reached(host string) (ok bool, detail string, err error)
}
Daemon is the running daemon, which must reach the machine by itself.
type Found ¶
type Found struct {
Name string // what the list shows
Target string // what ssh connects to
Source string // where smif saw it
Open bool // port 22 (or its configured port) answers
// contains filtered or unexported fields
}
Found is a machine you could add.
type Setup ¶
type Setup struct {
Host string // an ssh alias or user@host
Write bool // you may type into that machine's sessions
Ask Asker
Report func(Event)
Daemon Daemon
// contains filtered or unexported fields
}
Setup adds one machine. Set Host, Ask, Report and Daemon.