How to Protect Traefik Services with CrowdSec
If you expose self-hosted apps to the internet through Traefik, you will see scanners and brute-force attempts within hours. CrowdSec reads Traefik’s access log, spots attack patterns, and tells a Traefik plugin to return 403 to the offenders. This guide walks through the full setup with Docker Compose. How it fits together Internet → Traefik (https entrypoint) → crowdsec@file middleware → app │ │ │ writes JSON access log │ asks "is this IP banned?" ▼ ▼ ./traefik/logs ──────────► CrowdSec container (reads log, detects, decides) Traefik writes a JSON access log. The CrowdSec engine reads that log, matches attack scenarios, and creates ban decisions. It also pulls the community blocklist. The bouncer is a Traefik plugin, not a separate container. It asks CrowdSec’s local API whether an IP is banned and returns 403 if so. CrowdSec ignores private ranges (10.x, 172.16-31.x, 192.168.x) by default, so LAN traffic can’t get banned. ...