podman_args
podman_args
¶
Podman argv policy: the flag surface sandbox owns, and its gates.
Sandbox emits a set of podman run flags itself (naming, networking,
capabilities, its socket mounts) — those are managed: caller-supplied
args must never carry them, or they would silently fight the launch
assembly. This module is the single home for that policy: the
container-side mount-point constants the policy protects, the managed
flag/volume sets, and the validators every freeform-args entry point
runs (terok-sandbox run trailing args, run.podman_args config).
A foundation leaf by design: config_schema
validates run.podman_args at parse time and
launch enforces the same policy at
launch time — both import from here, so the two can never disagree.
CONTAINER_RUNTIME_DIR = '/run/terok'
module-attribute
¶
CONTAINER_VAULT_SOCKET = f'{CONTAINER_RUNTIME_DIR}/vault/vault.sock'
module-attribute
¶
CONTAINER_SSH_SIGNER_SOCKET = f'{CONTAINER_RUNTIME_DIR}/signer/ssh-agent.sock'
module-attribute
¶
CONTAINER_GATE_SOCKET = f'{CONTAINER_RUNTIME_DIR}/gate/gate-server.sock'
module-attribute
¶
CONTAINER_BRIDGES_DIR = '/usr/local/share/terok-sandbox/bridges'
module-attribute
¶
SANDBOX_MANAGED_FLAGS = frozenset({'--name', '--network', '--hooks-dir', '--annotation', '--cap-add', '--cap-drop', '--userns'})
module-attribute
¶
PASSTHROUGH_DENIED_FLAGS = frozenset({'--privileged', '--security-opt'})
module-attribute
¶
Flags additionally refused in freeform passthrough args.
Not sandbox-managed (sandbox doesn't always emit them) but
isolation-weakening: --privileged disables the seccomp/cap
confinement wholesale and --security-opt can drop SELinux labelling
or swap the seccomp profile. Anything on this list needs a vetted typed
channel (like RunSpec.caps), never a
freeform string.
reject_managed_flags(podman_args)
¶
Reject user-supplied flags that sandbox owns.
Mirrors terok-shield's _reject_shield_managed_flags and adds
sandbox-specific entries (e.g. --userns).
Source code in src/terok_sandbox/podman_args.py
reject_managed_volumes(podman_args)
¶
Reject -v host:target whose target overlaps a sandbox mount.
Source code in src/terok_sandbox/podman_args.py
validate_passthrough_args(podman_args)
¶
Validate operator-supplied freeform podman run args.
The one gate for config-sourced passthrough (run.podman_args):
rejects sandbox-managed flags, mount targets that would shadow
sandbox's sockets, and the isolation-weakening
PASSTHROUGH_DENIED_FLAGS.
Raises SystemExit like its building blocks; returns
the args as a tuple so callers can feed them straight to
RunSpec.extra_args.