Help us shape the future of Go! Take the 2026 Go Developer Survey

separate

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 19, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

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

Constants

This section is empty.

Variables

This section is empty.

Functions

func Check

func Check(o Options) error

Check refuses invalid or identical account names, and a socket mode other than 2710 or 2750.

func FileSum

func FileSum(path string) (string, error)

FileSum is the hex sha256 of the file at path.

func Fill

func Fill(p kit.Product, o *Options)

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

func InstalledBinary(p kit.Product) string

InstalledBinary is where the setup puts the binary the console runs.

func PinnedSource

func PinnedSource(p kit.Product, bin, pin, sumCmd string) (prefix, src string)

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

func Script(p kit.Product, goos, bin string, o Options, pin string) string

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 ShellQuote

func ShellQuote(s string) string

ShellQuote quotes s for sh.

func SocketDir

func SocketDir(p kit.Product, goos string) string

SocketDir is the shared socket directory on goos (as kit.Product's SharedSocketDir on that system).

func SourceRefusal

func SourceRefusal(p kit.Product, bin string) (string, error)

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.

func SystemTOML

func SystemTOML(p kit.Product, svc, group, dir string) string

SystemTOML is the system file of the setup (lockkit sysconf).

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL