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.
Copied from lockmq (same API) until it moves to lockkit; the one addition is Options.SocketMode.
Index ¶
- func Check(o Options) error
- 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 SystemTOML(p kit.Product, svc, group, dir string) string
- type Options
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Check ¶
Check refuses invalid or identical account names, and a socket mode other than 2710 or 2750.
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
// SocketMode is the socket directory's mode on Linux: "2710" when
// empty (the group may only reach a socket whose name it knows), or
// "2750" (the group may also list the directory: a client then finds
// the running consoles). lockkit's ipc accepts both.
SocketMode string
}
Options are the accounts of a separated setup.