CrowdSec¶
CrowdSec runs as the crowdsec container in the traefik-stack LXC (CT 117, 10.0.3.37,
/root/traefik-stack). It reads Traefik's access log, and its decisions are enforced by the
CrowdSec bouncer plugin inside Traefik on every HTTPS route.
internet ──► Traefik :443 ──► [crowdsec@file middleware] ──► route
│ ▲ decisions (stream, every 60 s)
└─ access.log ──► CrowdSec (LAPI crowdsec:8080)
▲ alerts + decisions
Traefik Manager ───┘ CrowdSec tab (manager.home.janwiebe.eu)
Moving parts¶
| Piece | Where | Notes |
|---|---|---|
| CrowdSec engine + LAPI | crowdsec container |
collections: traefik, http-cve, base-http-scenarios, linux, sshd, whitelist-good-actors |
| Log source | crowdsec/acquis.yaml |
/var/log/traefik/access.log, type traefik |
| Traefik plugin | traefik/traefik.yml → experimental.plugins.crowdsec-bouncer |
maxlerebourg/crowdsec-bouncer-traefik-plugin v1.8.2 |
| Middleware | traefik/config/crowdsec.yml → crowdsec@file |
stream mode, LAN ranges (10/8, 172.16/12, 192.168/16) are never blocked |
| Applied to | entryPoints.websecure.http.middlewares |
every HTTPS router (66 at setup time) |
| Plugin key | crowdsec/traefik-bouncer.key (mode 600) |
bouncer traefik-plugin, mounted read-only into Traefik |
| Traefik Manager | env CROWDSEC_LAPI_URL, CROWDSEC_API_KEY (bouncer traefik-manager), CROWDSEC_MACHINE_ID / CROWDSEC_MACHINE_PASSWORD (watcher traefik-manager, from .env, mode 600) |
bouncer key shows bans, watcher login shows alerts/attackers |
Backups of the files changed during setup are in /root/traefik-stack/backups-claude/.
Everyday commands (in CT 117)¶
cd /root/traefik-stack
docker exec crowdsec cscli decisions list # current bans
docker exec crowdsec cscli decisions delete --ip 1.2.3.4 # unban (or use the Traefik Manager tab)
docker exec crowdsec cscli alerts list -l 20
docker exec crowdsec cscli bouncers list # traefik-plugin must show a recent last_pull
docker exec crowdsec cscli metrics show acquisition # is the access log being read?
Turning it off quickly¶
Remove the middlewares: [crowdsec@file] lines under entryPoints.websecure in
traefik/traefik.yml and docker restart traefik. Restarting Traefik drops open
websockets (including Proxmox web shells that go through Traefik).