The Docker daemon should disable the Userland Proxy service

docker

Classification:

compliance

Framework:

cis-docker

Control:

2.17

Description

The Docker daemon should forward published ports with only iptables rules, with the userland proxy off.

Rationale

The userland proxy runs a docker-proxy process for every published port. On current kernels, the iptables rules of Docker forward the ports alone, and the proxy only adds processes that listen on the host.

Audit

Look for the userland proxy on the dockerd command line and in daemon.json:

ps -o args= -C dockerd
grep '"userland-proxy"' /etc/docker/daemon.json

Datadog reads --userland-proxy on the dockerd command line or, if it isn’t set there, userland-proxy in daemon.json. It passes the rule when the setting is false and fails it otherwise.

Remediation

Set userland-proxy to false in daemon.json:

{
  "userland-proxy": false
}

Then restart the daemon with systemctl restart docker.

Impact

Some older kernels and some network setups, such as hairpin connections to a published port from the host, need the proxy.

Default value

The userland proxy is on.

References

  1. https://windsock.io/the-docker-proxy/
  2. https://github.com/moby/moby/issues/14856
  3. https://github.com/moby/moby/issues/22741
  4. https://docs.docker.com/engine/network/