Book a 20-minute call
BlogExposure

Your firewall doesn't cover your Docker ports

You turned on ufw, denied everything, then ran docker compose up on a self-hosted AI starter kit. Your model server is on the internet anyway.

3

services in one popular starter kit published on every network interface: the model server, the vector database and the workflow editor

our review

175k

Ollama hosts SentinelLABS and Censys found on the open internet

Jan 2026

2%

of 36,769 exposed AI endpoints that asked for any authentication

CSA · Sep 2026

01 · What happens

Docker's rules run before ufw's

A compose line like "11434:11434" tells Docker to publish the port on every interface of the host. To do that, Docker writes its own iptables rules in the NAT table. Incoming packets meet those rules before they ever reach the INPUT chain where ufw keeps yours, so ufw deny 11434 never sees them.

Docker documents this in "Packet filtering and firewalls". The fix is to publish on 127.0.0.1, or to manage the rules with ufw-docker.

02 · What we found

One kit, three open doors

We read the compose file of a widely starred self-hosted AI starter kit. It runs a workflow tool, Ollama, Qdrant and Postgres on one host. Three of them are published with the short HOST:CONTAINER form, which means every interface:

  • Ollama on 11434. Ollama's API has no login. Anyone who can reach the port can run models on your hardware.
  • Qdrant on 6333, with no API key set in the file. That store holds the embeddings of whatever documents you loaded. We did not check whether the image enforces auth on its own, so "readable by anyone" is likely, not confirmed.
  • The workflow editor on 5678.

None of those host ports are needed for the stack to work. The services already talk to each other over a private Docker network by service name (ollama:11434, qdrant:6333). Postgres in the same file publishes no port at all, which shows the safer pattern was available.

The issue is already public: a community reply called the Ollama port "needlessly exposed" in 2025, and a community pull request proposed binding to localhost. A draft of the maintainers' next version removes that compose file.

03 · Fix it

One line per port

Before

# reachable from any network
# that routes to the host
ports:
  - "11434:11434"

After

# only programs on the host;
# other containers still use ollama:11434
ports:
  - "127.0.0.1:11434:11434"

If nothing outside Docker needs the port, delete the ports: entry instead. Then check from a second machine on another network. ufw status will tell you the port is closed, because as far as ufw knows, it is.

Check your own host

docker ps --format '{{.Names}}  {{.Ports}}' | grep '0.0.0.0'
# any line here is published on every interface

04 · Limits

What we did and didn't do

  • We read one public compose file at a fixed commit. We did not scan, probe or connect to anyone's servers.
  • Whether a given install is exposed depends on its host: a box behind NAT or a cloud security group may not be reachable. A VPS with a public IP usually is.
  • The internet-wide counts come from SentinelLABS/Censys and CSA, not from us.