sudoers

package
v0.23.0 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrUntrustedSource = errors.New("privileged helper source is not trusted")

ErrUntrustedSource means the running binary is not safe to install as the privileged helper (it is not root-owned, or its path is writable).

Functions

func Install

func Install(r runner.Runner, opts Options) error

Install writes the helper binary, its root-owned config, and the passwordless sudoers rule.

The rule authorizes a single fixed helper path. sudo-rs (the default sudo/su on Ubuntu 25.10+) forbids wildcards in command arguments, so the helper must resolve the container itself rather than receiving a PID and script from the caller. See internal/nshelper.

func IsInstalled

func IsInstalled(r runner.Runner) bool

IsInstalled reports whether the sudoers rule, helper, and helper config all exist. Requiring the config means an upgrade from the old shell-script helper counts as not installed and is replaced by start.

func Remove

func Remove(r runner.Runner)

Remove deletes the sudoers rule, the helper, and its config. Intentionally graceful: missing files and failed removals are not errors.

Types

type Options added in v0.20.4

type Options struct {
	User    string
	Machine string
	UID     int
	GID     int
	Home    string
	Rootfs  string
	// AllowUntrustedSource is set only by the explicit, sudo-authenticated
	// `init` command. `start` leaves it false so a user-owned binary cannot
	// refresh the root-owned helper without an explicit install.
	AllowUntrustedSource bool
}

Options are the values baked into the root-owned helper and its config.

Jump to

Keyboard shortcuts

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