Docker Bypasses UFW, Exposing Denied Ports to the Internet
A developer found that Postgres, Redis, and an internal admin dashboard were reachable from the internet despite explicit UFW deny rules on their VPS. The cause is that Docker publishes container ports through NAT rules that are evaluated before UFW's INPUT chain, so the packets are forwarded to containers and never checked against UFW. The author describes a five-minute reproduction on a test VM showing UFW reporting a port as denied while Docker still served it. Recommended fixes include not publishing internal ports, binding them to 127.0.0.1, setting a loopback default in daemon.json, or filtering traffic in the DOCKER-USER chain. Disabling iptables in Docker is discouraged because it breaks container networking.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in