Documentation
¶
Overview ¶
Package sandboxsetup is Linux's OS sandbox, from outside the engine: whether bubblewrap can run here, and, where AppArmor's restriction on unprivileged user namespaces stops it (Ubuntu 24.04 and later), an AppArmor profile that lets bwrap alone have them, installed with the user's password (sudo or pkexec). The CLI (blitz security) and the desktop app's settings use it.
Index ¶
Constants ¶
const ProfileName = "blitz-bwrap"
ProfileName is the AppArmor profile Fix installs, and its file's name in /etc/apparmor.d: Blitz's own, so a distribution's bwrap profile stays.
Variables ¶
var ErrCantFix = errors.New("not something an AppArmor profile fixes")
ErrCantFix: the sandbox's problem isn't one Fix can help.
var ErrNoElevation = errors.New("neither sudo nor pkexec is installed")
ErrNoElevation: neither sudo nor pkexec is installed.
Functions ¶
Types ¶
type Elevation ¶
type Elevation struct {
Command string
Stdin io.Reader
Stdout, Stderr io.Writer
// Graphical uses pkexec only: without a terminal, sudo can't ask.
Graphical bool
}
Elevation is how Fix runs its one privileged step: Command is sudo (in a terminal, which asks for the password there) or pkexec (the desktop's password dialog). Stdin, Stdout and Stderr are the terminal's, for sudo.
type State ¶
type State string
State is what Check found.
const ( // Unsupported: not Linux, whose sandbox (Seatbelt on macOS) needs no // set-up, or which has none. Unsupported State = "unsupported" // Ready: bubblewrap runs. Ready State = "ready" // NoBwrap: bubblewrap isn't installed. NoBwrap State = "no_bwrap" // Restricted: AppArmor's restriction on unprivileged user namespaces // stops bubblewrap, and Fix can lift it for bwrap alone. Restricted State = "restricted" // Broken: bubblewrap fails for another reason (a container's seccomp // profile, a kernel without user namespaces) that Fix can't help. Broken State = "broken" )
The states.
type Status ¶
type Status struct {
State State `json:"state"`
Bwrap string `json:"bwrap,omitempty"` // its real path
Detail string `json:"detail,omitempty"` // bwrap's error
// Profile is where Fix writes (or wrote) the profile.
Profile string `json:"profile,omitempty"`
}
Status is the sandbox's state here, with the bwrap it found and why it fails, if it does.