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

separate

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2026 License: Apache-2.0 Imports: 13 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.

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.

func FileLinks(fi os.FileInfo) (n int, ok bool)

FileLinks returns the hard link count of a file (ok false off Unix).

func FileOwner

func FileOwner(fi os.FileInfo) (uid int, ok bool)

FileOwner returns the owner of a file (ok false off Unix).

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 SubUID

func SubUID(subuid, user string, userUID, uid int) (int, error)

SubUID maps a uid inside a rootless container of user to the host uid (/etc/subuid content): uid 0 is the user itself, uid n >= 1 is subuid_start + n - 1.

func SystemTOML

func SystemTOML(p kit.Product, svc, group, dir string, allowed []int) 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
	// 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.

Jump to

Keyboard shortcuts

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