#71 raises this in one clause and it is the largest thing in the file:
alloy:
privileged: true
cgroup: host
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
- /:/rootfs:ro
privileged: true plus the Docker socket is root on the host — the socket alone
is enough to start a container with / bind-mounted read-write. And /:/rootfs
is read access to every file on the host, including
~/.config/sops/age/keys.txt, which is the single point of failure for every
secret in this repository, on an unencrypted disk.
Everything else in #71 is rounding error next to this. It is also why the other
hardening issues (#186, #187) deliberately exclude Alloy: a cap_drop next to a
privileged: true is a control that cannot act.
Why this is not a quick change
cgroup: host is required — compose.yaml explains at length that without
it cAdvisor reports exactly one series, id="/", and every per-container metric
disappears while the exporter stays healthy and the dashboard stays empty. That
is the #62 failure and it is silent, which is what makes this risky rather than
merely fiddly.
privileged: true may not be required. The documented minimum for the
cAdvisor + Docker pattern is closer to:
cap_add: [SYS_ADMIN, SYS_PTRACE, DAC_READ_SEARCH]
device_cgroup_rules for the block devices cAdvisor stats
security_opt: ["apparmor:unconfined"] on some hosts
and the socket could go behind a read-only proxy (e.g. a docker-socket-proxy
exposing only GET /containers, /images, /info) rather than being mounted
directly.
Done when
Prerequisite for getting real value out of #186 and #187.
Found while doing #71 / #184.
#71 raises this in one clause and it is the largest thing in the file:
privileged: trueplus the Docker socket is root on the host — the socket aloneis enough to start a container with
/bind-mounted read-write. And/:/rootfsis read access to every file on the host, including
~/.config/sops/age/keys.txt, which is the single point of failure for everysecret in this repository, on an unencrypted disk.
Everything else in #71 is rounding error next to this. It is also why the other
hardening issues (#186, #187) deliberately exclude Alloy: a
cap_dropnext to aprivileged: trueis a control that cannot act.Why this is not a quick change
cgroup: hostis required —compose.yamlexplains at length that withoutit cAdvisor reports exactly one series,
id="/", and every per-container metricdisappears while the exporter stays healthy and the dashboard stays empty. That
is the #62 failure and it is silent, which is what makes this risky rather than
merely fiddly.
privileged: truemay not be required. The documented minimum for thecAdvisor + Docker pattern is closer to:
cap_add: [SYS_ADMIN, SYS_PTRACE, DAC_READ_SEARCH]device_cgroup_rulesfor the block devices cAdvisor statssecurity_opt: ["apparmor:unconfined"]on some hostsand the socket could go behind a read-only proxy (e.g. a docker-socket-proxy
exposing only
GET /containers,/images,/info) rather than being mounteddirectly.
Done when
privileged: true, or it is written down why it cannotcontainer_*series count and the Docker Containers dashboard are comparedbefore and after — the failure mode here is silence, not an error
containers.rules.yamlthat depend on cAdvisor stillhave data
docs/security.mdandSECURITY.mdupdated, since both currently listthe read-only socket as the mitigation
Prerequisite for getting real value out of #186 and #187.
Found while doing #71 / #184.