security.frabs.net
All Guides

Open Services · about 5 minutes

Lock Down the Docker Socket

What This Means

Every user on the server can write to Docker's socket.

Why It Matters

Anyone who can talk to Docker can start a container with your whole disk mounted, which is the same as being root.

  1. 1

    See who can use it

    It should be owned by root and the docker group, mode srw-rw----.

    ls -l /var/run/docker.sock
  2. 2

    Fix it now

    chown root:docker /var/run/docker.sock && chmod 660 /var/run/docker.sock
  3. 3

    Keep it fixed after restarts

    Docker recreates the socket when it starts; set the mode on its socket unit so it stays right.

    mkdir -p /etc/systemd/system/docker.socket.d && printf '[Socket]\nSocketMode=0660\nSocketGroup=docker\n' > /etc/systemd/system/docker.socket.d/override.conf && systemctl daemon-reload && systemctl restart docker.socket

Check It’s Fixed

Run the security report again. This check should now pass.

More Open Services Guides

Close Databases and Admin Services to the InternetTurn On a Firewall