For AI agents: A markdown version of this page is available at https://docs.datadoghq.com/security/default_rules/tpb-xvh-rnd.md. A documentation index is available at /llms.txt.

The file permissions on docker.socket should be set to 644 or stricter

docker

Classification:

compliance

Framework:

cis-docker

Control:

3.4

Description

The docker.socket unit file should have mode 644 or stricter.

Rationale

The docker.socket unit creates the socket of the Docker daemon. Mode 644 or stricter leaves only root able to write it.

Audit

Find the unit file that systemd uses, then show its mode:

systemctl show -p FragmentPath docker.socket
stat -c '%a' /usr/lib/systemd/system/docker.socket

Datadog checks docker.socket in /etc/systemd/system, /run/systemd/system, /usr/local/lib/systemd/system, /usr/lib/systemd/system, or /lib/systemd/system. It passes the rule when every copy found has mode 644 or stricter, fails it when one has a less strict mode, and reports it not applicable when there is none.

Remediation

Set the mode of the unit file that systemd uses:

chmod 644 /usr/lib/systemd/system/docker.socket

Impact

None.

Default value

The Docker packages install the unit files in /usr/lib/systemd/system with owner root:root and mode 644.

References

  1. https://docs.docker.com/reference/cli/dockerd/#bind-docker-to-another-hostport-or-a-unix-socket
  2. https://github.com/YungSang/fedora-atomic-packer/blob/master/oem/docker.socket