CRITICAL Ollama: Ollama API open to the internet
Why it matters
Anyone on the internet can talk to your Ollama server: list your models, run inference on your GPU (you pay the power/hardware bill), and pull or delete models. Exposed Ollama instances are scanned for within hours of going online — this is one of the most commonly found exposed AI services, with well over a hundred thousand of them visible on the public internet.
Fix it — 3 steps
- Bind Ollama to localhost only: set OLLAMA_HOST=127.0.0.1 (e.g. `sudo systemctl edit ollama` → add `Environment="OLLAMA_HOST=127.0.0.1"`), then `sudo systemctl restart ollama`.
- If you need remote access, keep it on 127.0.0.1 and front it with a reverse proxy (Caddy or nginx) that enforces authentication and TLS.
- Also block the port at the firewall as a seatbelt: `sudo ufw deny 11434`.
Verify it’s fixed
curl -m 5 http://YOUR_SERVER_IP:11434/api/tags # should time out / connection refused; curl http://127.0.0.1:11434/api/tags on the server itself should still work
References
- https://github.com/ollama/ollama/blob/main/docs/faq.md#how-do-i-configure-ollama-server
- https://www.oligo.security/blog/shadowray-attack-ai-workloads-actively-exploited-in-the-wild
Not sure if your stack is exposed?
Run the free check — 30 seconds, safe read-only probes.
Scan your stack