Documentation
¶
Overview ¶
Package separate builds the one-time root setup that separates a product's console from the agent: a console account, a clients group the agent's account joins, the root-owned system file the console requires (lockkit sysconf), the shared socket directory, and a root-owned copy of the binary. It is parameterised by kit.Product and holds no product name of its own. It only builds and checks; running the script (sudo) is the caller's.
Index ¶
- func Check(o Options) error
- func FileLinks(fi os.FileInfo) (n int, ok bool)
- func FileOwner(fi os.FileInfo) (uid int, ok bool)
- func FileSum(path string) (string, error)
- func Fill(p kit.Product, o *Options)
- func InstalledBinary(p kit.Product) string
- func PinnedSource(p kit.Product, bin, pin, sumCmd string) (prefix, src string)
- func Script(p kit.Product, goos, bin string, o Options, pin string) string
- func ShellQuote(s string) string
- func SocketDir(p kit.Product, goos string) string
- func SourceRefusal(p kit.Product, bin string) (string, error)
- func SubUID(subuid, user string, userUID, uid int) (int, error)
- func SystemTOML(p kit.Product, svc, group, dir string, allowed []int) string
- type Options
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Fill ¶
Fill sets the defaults: p's account and clients group, and the account sudo was run from (else the current one) as the client.
func InstalledBinary ¶
InstalledBinary is where the setup puts the binary the console runs.
func PinnedSource ¶
PinnedSource is the start of a root script that copies bin to a root-owned temporary file and checks it against the sha256 pin (sumCmd checks a "<sha256> <path>" line on stdin), stopping before any change on a mismatch; src is the file to install. Without a pin, bin itself is the source (SourceRefusal accepted it).
func Script ¶
Script is the root script of a separated setup on goos (linux or darwin). pin, when set, is the sha256 the copied binary must match (--trust-binary).
func SocketDir ¶
SocketDir is the shared socket directory on goos (as kit.Product's SharedSocketDir on that system).
func SourceRefusal ¶
SourceRefusal returns the refusal to print when bin, the binary the setup would copy as root, could have been changed by an account other than root (a binary the agent replaced would become the one the console trusts); "" for a root-owned binary neither group nor others may write.
Types ¶
type Options ¶
type Options struct {
// Client is the account the agent runs as; Service the console
// account; Group the clients group.
Client, Service, Group string
// AllowedUIDs may reach the console besides the group's members: the
// gate's uid as the host sees it.
AllowedUIDs []int
}
Options are the accounts of a separated setup.