Commit Graph
1 Commits
Author SHA1 Message Date
Hasan BasbunarandClaude Opus 5.5 b92bd97193 proxy unit: no more of the machine than the proxy uses
The proxy is what a client's bytes reach first, on every address the
box has (PROXY_BIND is 0.0.0.0 by default), and its unit ran it with
all of this user's rights: the docker group, with docker's socket one
connect away, and the cockpit's sudo commands. A flaw of the proxy was
a flaw of the box. The unit now runs it with no new privileges, the
system and the homes read-only, a private /tmp and /dev, the kernel's
tunables, modules, logs and the cgroups read-only, no capabilities,
the system calls of a service (EPERM for the others, so a call outside
the set fails in the call instead of killing the proxy), four address
families, and docker's socket out of reach.

The lines hold because of what the proxy does: it reads its code, its
key and what the operator names, runs systemctl to read the lanes'
state, and writes nothing on disk. tests/test_proxy_unit_sandbox.py
checks those in its code (every subprocess call is a systemctl, no
open() for writing, no os, shutil or tempfile writer, no path method
that writes), so a proxy that needs more says so there and in its unit.

Found in a cloud review of v1.36.1 (pull request #52), where
systemd-analyze security --offline rated the unit 1.8 OK, from 9.0
UNSAFE. On the reference box, the unit rendered from this commit runs
the proxy with NoNewPrivs 1, seccomp filtering and no capability, rated
1.8 OK; Claude Code, opencode, Hermes, pi, both SDKs, fetch under Node
and Bun and LiteLLM all answered through it; a request sent while the
flash lane restarted was held 758 s, then answered; and a test proxy in
a transient unit carrying the same lines read its TLS pair and a client
keys file (200 for the listed key, 401 for another, plain HTTP
refused). Its journal had no EPERM, no "Permission denied" and no
read-only error.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-18 20:28:35 +02:00