Documentation
¶
Overview ¶
Package priv implements irreversible root privilege dropping and pre-drop secret file lockdown on Linux containers. At startup (while still UID 0), LockDownSecretPaths enforces 0600 root:root on /data/options.json and 0700 root:root on /data; then DropRoot invokes PR_SET_NO_NEW_PRIVS + Setgroups([]) + Setgid(65532) + Setuid(65532) across all Go runtime OS threads (AllThreadsSyscall6) before any network socket opens or Chromium subprocess spawns, guaranteeing VFS DAC blocks UID 65532 (and all child processes) from reading /data/options.json on every Linux kernel.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DropRoot ¶
func DropRoot() error
DropRoot permanently transitions UID/GID 0 down to unprivileged `65532:65532` (`nonroot`) and sets `NO_NEW_PRIVS`.
func LockDownSecretPaths ¶ added in v2.5.4
func LockDownSecretPaths(paths ...string)
LockDownSecretPaths restricts secret configuration files (such as Home Assistant `/data/options.json`) to `0600` owned by `0:0` (`root:root`) and locks `/data` to `0700` while the process is still UID 0, right before DropRoot(). Once DropRoot() transitions the process to UID/GID 65532, Linux VFS DAC unconditionally denies access to `/data` and `/data/options.json` for both `/edgefetch` and any spawned Chromium / helper child processes.
Types ¶
This section is empty.