TMAegis
More rules for docker

TMA-DOCKER-3.2

Ensure that docker.service file permissions are appropriately set

HighLevel 1Automateddocker

Description

The docker.service unit file must have mode 644 or more restrictive so that it cannot be modified by non-root users. The audit flags any existing candidate path (/usr/lib/systemd/system/docker.service, /lib/systemd/system/docker.service, /etc/systemd/system/docker.service) with permission bits outside 644; not applicable when none exists.

How it is checked

Audit method: Shell command

shell
for f in /usr/lib/systemd/system/docker.service /lib/systemd/system/docker.service /etc/systemd/system/docker.service; do [ -e "$f" ] || continue; out=$(find "$f" -maxdepth 0 -perm /7133) || exit 1; [ -z "$out" ] || { echo "$f"; exit 0; }; done; echo compliant
Expected output
compliant

How it is fixed

Fix method: Shell command

shell
for f in /usr/lib/systemd/system/docker.service /lib/systemd/system/docker.service /etc/systemd/system/docker.service; do if [ -e "$f" ]; then chmod 644 "$f" || exit 1; fi; done

Properties

Operating systems
Any
Tags
dockerpermissions
Reference
CIS Docker Benchmark v1.9.0 - 3.2 Ensure that docker.service file permissions are appropriately set

Check this host

Run this on a machine you are allowed to audit. The scan is read-only.

shell
tmaegis scan --target docker