Skip to content

Docker audit fixes

Daemon & Socket: fixing all 8 checks

The daemon and socket audit reads dockerd's command line, /etc/docker/daemon.json and the docker group to establish who can reach the Docker API, which is root on the host under another name.

Only three of the eight checks talk to the daemon, so Docker Inventory, Docker Socket In Containers and Rootless Mode are the ones that skip when the audit account is neither root nor a member of the docker group. The other five read the dockerd process arguments, /etc/docker/daemon.json or getent group docker instead, so they skip only when the docker binary is missing, and the group membership check never skips at all.

CtrlOpsDaemon & Socket audit8 CHECKS
Checks in this audit
8
Rated high severity
2
Need root or sudo
3
Automated run time
~12s

Transcribed from the docker-security-daemon-socket audit script. For what the audit covers rather than how to fix it, see the Daemon & Socket checklist, or how the CtrlOps Security Audit runs.

Every check

Find your finding

Listed in the order the audit runs them. Take the check name from the third field of the result line and open its page.

  1. 01Docker InventoryBaseline inventory of the Docker engine, runc version, containers and imagesSeverity: LOWNeeds rootCan return SKIP · PASS
  2. 02Docker TCP SocketCheck whether the Docker daemon is exposed over an unauthenticated TCP socketSeverity: HIGHNo root neededCan return FAIL · WARN · SKIP · PASS
  3. 03Docker Socket In ContainersCheck whether any running container has docker.sock mounted, granting host rootSeverity: HIGHNeeds rootCan return FAIL · SKIP · PASS
  4. 04Docker Group MembersList members of the docker group, each of whom is root-equivalent via the socketSeverity: MEDIUMNo root neededCan return WARN · PASS
  5. 05Daemon Log LevelCheck the Docker daemon log level to avoid sensitive data leakage via debug logsSeverity: LOWNo root neededCan return WARN · SKIP · PASS
  6. 06Rootless ModeCheck whether the Docker daemon runs in rootless mode to shrink escape blast radiusSeverity: LOWNeeds rootCan return WARN · SKIP · PASS
  7. 07User Namespace RemappingWhether container root maps to an unprivileged host uidSeverity: MEDIUMNo root neededCan return WARN · SKIP · PASS
  8. 08Container Log LimitsLog driver rotation limits so container logs cannot fill the diskSeverity: LOWNo root neededCan return WARN · SKIP · PASS

Shared script behaviour

How the Daemon & Socket audit reads your server

Every check in this audit runs after the same preamble, and several of its results only make sense once you know what that preamble could and could not see.

The preamble

Docker detection: DOCK=direct if docker ps works as the audit user (docker group), DOCK=root if it works through sudo; the dk helper wraps docker accordingly. IDS is the list of running container IDs and NRUN their count; dk inspect --format is used with Go templates. Podman is recognised but not audited.

Why checks skip

A SKIP is never a pass

A skipped check verified nothing at all. The most common cause is privilege: 3 of the 8 checks in this audit need root for a complete result. Before every run, each script works out which of four privilege modes it is in.

rootThe audit runs as UID 0.Every privileged branch runs directly. No check skips for lack of permission.
nopasssudo -n true succeeds, so the account has passwordless sudo.Privileged commands run through sudo -n.
passA sudo password was supplied in the CtrlOps audit settings and accepted.Privileged commands run through sudo -S.
noneSKIPNone of the above worked.CAN_ROOT=0. Every privileged branch returns SKIP with a "Need root" message rather than guessing.

If many checks skip with a “need root” message, run the audit as root, grant the audit account sudo (with or without NOPASSWD), or supply the sudo password in the CtrlOps audit settings. For Docker checks, membership of the docker group is an alternative to sudo: run usermod -aG docker <user> and log in again.

Keep going

FAQ

Daemon & Socket questions

Can't find your answer? Join Discord

  • Because only some of them ask it anything. The script sets DOCK=direct when docker ps works as the audit user, DOCK=root when it works through sudo, and leaves it empty otherwise, and Docker Inventory, Docker Socket In Containers and Rootless Mode all short-circuit to SKIP on an empty DOCK. The remaining checks read the dockerd process arguments and /etc/docker/daemon.json, which need no daemon connection at all. Add the audit account to the docker group or run the audit as root and those three fill in.

  • It combines three independent signals and any one of them is enough: a listener whose address ends in :2375 or :2376 from ss -tln, a -H tcp:// argument on the running dockerd command line, and a tcp:// entry in the "hosts" array of /etc/docker/daemon.json. A daemon configured for TCP but not currently listening is therefore still reported. The port number alone then decides severity, so 2376 is a WARN on the assumption that TLS is in use and anything else is a FAIL; the check never confirms that --tlsverify and client certificates are actually enforced.

  • Not without a maintenance window. Enabling userns-remap moves images and containers under /var/lib/docker/<uid>.<gid>, so everything you already have disappears from docker ps and docker images until it is pulled and recreated, and root-owned files on bind mounts become unreadable inside the container. Workloads that need --pid=host, --net=host or --privileged have to opt out with --userns=host. Prove it on a staging host before touching production.

Stop juggling tools. Start managing fleets.

PuTTY
Termius
MobaXterm
WinSCP
SecureCRT
Royal TS
Warp
CtrlOps14 tools left
Webmin
aaPanel
RunCloud
Dokploy
IP spreadsheet
bash (2)
sticky notes

One app. All your servers. No context switching. Free to start, free to leave.

Start instantly · No credit card · Cancel anytime

Your privacy preferences. We use product analytics to improve CtrlOps. Google Analytics cookies and live chat stay off until you allow them. Cookie policy