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 means the sandbox's problem isn't one Fix can help.
var ErrNoElevation = errors.New("neither sudo nor pkexec is installed")
ErrNoElevation means neither sudo nor pkexec is installed.
var ErrNotSystemBwrap = errors.New("isn't a system program (owned by root and writable by root alone, in folders that are too): install bubblewrap from the system's packages, or put /usr/bin before it on PATH")
ErrNotSystemBwrap means the bwrap found isn't a system program: the profile, written as root, would lift the restriction for a file the person (or anything running as them) could replace.
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 means the OS isn't Linux: its sandbox (Seatbelt on macOS) // needs no set-up, or it has none. Unsupported State = "unsupported" // Ready means bubblewrap runs. Ready State = "ready" // NoBwrap means bubblewrap isn't installed. NoBwrap State = "no_bwrap" // Restricted means AppArmor's restriction on unprivileged user namespaces // stops bubblewrap, and Fix can lift it for bwrap alone. Restricted State = "restricted" // Broken means 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.