crowdsec-bouncer-traefik-plugin: [HELP] Bouncer not blocking banned IPs
Hello,
I have crowdsec installed in OPNsense machine that works as LAPI. Also we have a crowdsec docker container (LAPI disabled) that connects to OPNsense LAPI for acquiring logs of traefik using crowdsecurity/traefik collection.
crowdsec:
container_name: crowdsec
image: crowdsecurity/crowdsec
restart: unless-stopped
environment:
TZ: Europe/Madrid
DISABLE_LOCAL_API: true
LOCAL_API_URL: "OPNSense LAPI URL"
AGENT_USERNAME: "---"
AGENT_PASSWORD: "---"
COLLECTIONS: "crowdsecurity/traefik"
GID: "${GID-1000}"
volumes:
- /mnt/docker/crowdsec/acquis.yaml:/etc/crowdsec/acquis.yaml
- traefik_logs:/var/log/traefik
- crowdsec_db_data:/var/lib/crowdsec/data/
- crowdsec_data:/etc/crowdsec/
Adding a new bouncer in OPNsense Crowdsec to get API KEY using:
cscli bouncers add traefik-bouncer
I’ve installed traefik bouncer plugin using this labels and then I’ve attached the middleware to the docker service:
environment:
# GET REAL IP FROM CLOUDFLARE
- TRAEFIK_ENTRYPOINTS_WEBSECURE_PROXYPROTOCOL_TRUSTEDIPS=173.245.48.0/20,103.21.244.0/22,103.22.200.0/22,103.31.4.0/22,141.101.64.0/18,108.162.192.0/18,190.93.240.0/20,188.114.96.0/20,197.234.240.0/22,198.41.128.0/17,162.158.0.0/15,104.16.0.0/13,104.24.0.0/14,172.64.0.0/13,131.0.72.0/22
- TRAEFIK_ENTRYPOINTS_WEBSECURE_FORWARDEDHEADERS_TRUSTEDIPS=173.245.48.0/20,103.21.244.0/22,103.22.200.0/22,103.31.4.0/22,141.101.64.0/18,108.162.192.0/18,190.93.240.0/20,188.114.96.0/20,197.234.240.0/22,198.41.128.0/17,162.158.0.0/15,104.16.0.0/13,104.24.0.0/14,172.64.0.0/13,131.0.72.0/22
# ADD Traefik Bouncer Plugin
- TRAEFIK_EXPERIMENTAL_PLUGINS_BOUNCER_MODULENAME=github.com/maxlerebourg/crowdsec-bouncer-traefik-plugin
- TRAEFIK_EXPERIMENTAL_PLUGINS_BOUNCER_VERSION=v1.1.16
labels:
traefik.http.middlewares.crowdsec.plugin.bouncer.enabled: true
traefik.http.middlewares.crowdsec.plugin.bouncer.loglevel: "DEBUG"
traefik.http.middlewares.crowdsec.plugin.bouncer.crowdseclapihost: "OPNsense LAPI host"
traefik.http.middlewares.crowdsec.plugin.bouncer.crowdseclapikey: "API KEY GENERATED IN OPNSense LAPI"
traefik.http.middlewares.crowdsec.plugin.bouncer.crowdsecmode: "stream"
traefik.http.middlewares.crowdsec.plugin.bouncer.forwardedheaderstrustedips: "173.245.48.0/20,103.21.244.0/22,103.22.200.0/22,103.31.4.0/22,141.101.64.0/18,108.162.192.0/18,190.93.240.0/20,188.114.96.0/20,197.234.240.0/22,198.41.128.0/17,162.158.0.0/15,104.16.0.0/13,104.24.0.0/14,172.64.0.0/13,131.0.72.0/22" # CLOUDFLARE IPS
So apparently works but not blocking clients when accessing to the service…
traefik-bouncer 192.168.1.4 ✔️ 2023-10-19T10:25:52Z Go-http-client 1.1 api-key
DEBUG: CrowdsecBouncerTraefikPlugin: 2023/10/19 12:02:52 handleStreamCache:updated
DEBUG: CrowdsecBouncerTraefikPlugin: 2023/10/19 12:02:52 New initialized mode:stream
DEBUG: CrowdsecBouncerTraefikPlugin: 2023/10/19 12:22:52 cache:SetDecision ip:31.4.140.XXX isBanned:true duration:14357s
DEBUG: CrowdsecBouncerTraefikPlugin: 2023/10/19 12:22:52 handleStreamCache:updated
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 17 (6 by maintainers)
OMG, my bad. Thx 😦