Skip to content

Reference The 25 checks

Docker bypassing the firewall

Security check docker-firewall

What it reads

The ports Docker publishes on all addresses, and the ufw rules for them.

Does it need root?

It needs root for part of what it reads. Reading the ufw rules and the Docker socket needs root. Without root, that part is skipped and never counted as passed. Run sudo kiyesi scan to include it.

When it passes

The report lists it as passed, in these words:

  • Docker publishes no port the firewall says is closed

What it can find

Warning

Docker publishes port port past the firewall

ufw says this port is closed, but Docker opens it anyway, so it can be reached from the internet.

Fix, to review and run yourself
bind the port to 127.0.0.1 in docker-compose.yml, then
docker compose up -d service
Info

Docker publishes web port port past the firewall

ufw says port port is closed, but Docker opens it anyway. For a website that is what you want, so it costs no points, but the firewall's rules no longer say what is open. Never bind it to 127.0.0.1 if it serves your site: the site would go offline.

Fix, to review and run yourself
If service serves your website, allow the port in the firewall too, so its rules say what is open:
sudo ufw allow port/tcp
If it should not be public, bind it to 127.0.0.1 in docker-compose.yml, then
docker compose up -d service