privexec

package
v0.24.0 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package privexec is the daemon's privileged-exec delegation seam.

The solo-provisioner-daemon runs unprivileged (systemd `User=weaver`) and performs every privileged operation by exec'ing the root solo-provisioner CLI under sudo — the privilege-by-exec-delegation model documented in docs/dev/daemon/daemon-architecture.md and the BN traffic-shaper design's daemon-vs-CLI separation. This package is the ONLY place in the daemon's import closure that reaches for os/exec, and it execs nothing but sudo + solo-provisioner: never kubectl/helm/systemctl/nft/tc directly. The sudoers grant (internal/templates/files/weaver/sudoers) is the single escalation path and is restricted to the solo-provisioner binary.

The delegation is synchronous (run, wait, capture output) — distinct from the self-upgrade protocol's detached child spawn, which is a separate mechanism.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Delegator

type Delegator interface {
	// Run execs `sudo <solo-provisioner> <args...>`, waits for completion, and
	// returns the command's stdout. A missing sudo/CLI binary, a denied sudo
	// grant, or a non-zero exit returns a *daemonkit.ProbeError describing the
	// failure and how to resolve it; on success err is nil and the returned
	// bytes are stdout only (stderr is folded into the error, never stdout, so
	// callers can parse `--output json`).
	Run(ctx context.Context, args ...string) ([]byte, error)

	// NetworkPolicySet delegates `network policy set --name <name>
	// [--cidrs <csv>]` — the statusz poll loop's membership write path. It
	// atomically replaces the named policy's live nft set with cidrs; an empty
	// (or nil) cidrs slice clears the set (the --cidrs flag is omitted).
	NetworkPolicySet(ctx context.Context, name string, cidrs []string) error
}

Delegator runs privileged solo-provisioner subcommands under sudo on behalf of the unprivileged daemon. Failures carry an operator-facing Reason and Resolution (via *daemonkit.ProbeError) so the caller can surface them through the component's /status endpoint.

func New

func New() Delegator

New returns a Delegator wired to the host's sudo and solo-provisioner binaries.

Jump to

Keyboard shortcuts

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