Documentation
¶
Overview ¶
Package gatehere holds the rules of ssh-gate's server mode (--here): a phone's key that logs in to a server runs komando there through the gate, and the gate decides what may run on that server itself. The rules are pure: the cli hands in the paths and the command's words.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var SSHFiles = []string{"authorized_keys", "authorized_keys2", "config", "rc", "environment"}
SSHFiles are the files in ~/.ssh sshd reads for a login. The whole folder is protected; these are named so a refusal says which.
var StartDirs = []string{".config/fish", ".config/environment.d", ".config/systemd", ".config/autostart"}
StartDirs are folders in the home whose files a shell or a login reads.
var StartFiles = []string{
".profile", ".bash_profile", ".bash_login", ".bashrc", ".bash_logout",
".zshenv", ".zprofile", ".zshrc", ".zlogin", ".zlogout",
".shrc", ".kshrc", ".mkshrc", ".cshrc", ".tcshrc", ".login", ".logout",
".xprofile", ".xsession", ".xsessionrc", ".xinitrc", ".pam_environment",
}
StartFiles are the files a shell or a login reads as it starts, in the home: a line written there runs at the user's next login.
Functions ¶
func Keys ¶
func Keys() (run, shell [][3]string)
Keys are the (type, area, verb) keys the server mode names: those it runs and the shells it refuses. TestGateHereKeysNameTheTree in internal/cli holds them to the command tree.
func NextTo ¶
NextTo are the folders next to home (/home/*, /Users/*), as other users' homes: the users a system keeps outside /etc/passwd (macOS, a directory service) have their homes there too. Folders starting with a dot, and macOS's /Users/Shared, are no homes.
func OtherHomes ¶
OtherHomes are the homes of the users in an /etc/passwd text other than the one at home. A home counts when its last word is the user's name (/home/budi, /root): /usr/sbin, / and /nonexistent are none.
func Resolve ¶
Resolve is path as an absolute path with every symlink resolved, also one that points at nothing yet and one under a folder that does not exist yet: what a write to path would really change.
Types ¶
type Paths ¶
type Paths struct {
Home string // the paired user's home, from the user database
Komando string // komando's own folder: settings, rules, guard, audit
Self string // the gate's own binary, symlinks resolved
Homes map[string]string // every other user's home, by name (OtherHomes)
}
Paths are what the server mode protects (rule a), for the user the key logs in as.
func (Paths) WriteRefusal ¶
WriteRefusal says why a command through the gate may not write, move, remove or change the mode of path, or "" (rule a). It checks the path as named and as its symlinks resolve, a parent folder of a protected place (a rename moves what is in it), and a file with other names (a hardlink of a protected file is that file).