Files
ansible/roles/docker/templates/crowdsec-compose.yml.j2
T
PhilandClaude Opus 5.5 41e9428412 crowdsec: host sshd + Gitea logs, nftables firewall bouncer (SSH bans only for now), weekly hub update
- crowdsec image -> latest-debian (journalctl); reads host journal (sshd)
  and Gitea's log file (LePresidente/gitea); LAPI on 127.0.0.1:8080
- gitea also logs to /data/gitea/log/gitea.log (router lines console only)
- host: crowdsec-firewall-bouncer-nftables from packagecloud any/any, own
  nft tables on input+forward hooks; limited to local ssh detections and
  manual bans until crowdsec_firewall_all_decisions
- weekly cscli hub update/upgrade + SIGHUP

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 13:26:00 -07:00

58 lines
1.8 KiB
Django/Jinja

# CrowdSec: reads Caddy's access log, the host's sshd journal and Gitea's
# log, decides which IPs to ban, and serves those decisions to Caddy (lava)
# and to the host firewall bouncer (LAPI on 127.0.0.1:8080 only).
services:
crowdsec:
# -debian: the Alpine image has no journalctl (needed for host sshd logs)
image: crowdsecurity/crowdsec:{{ crowdsec_version | default('latest') }}-debian
container_name: crowdsec
restart: unless-stopped
env_file: .env # BOUNCER_KEY_caddy
environment:
COLLECTIONS: >-
crowdsecurity/caddy crowdsecurity/http-cve crowdsecurity/base-http-scenarios
crowdsecurity/appsec-virtual-patching
crowdsecurity/linux crowdsecurity/sshd LePresidente/gitea
TZ: Etc/UTC
ports:
- "127.0.0.1:8080:8080" # LAPI, for the host firewall bouncer only
volumes:
- crowdsec_config:/etc/crowdsec
- crowdsec_data:/var/lib/crowdsec/data
- ./acquis.d:/etc/crowdsec/acquis.d:ro
# Only the logs/ folder of Caddy's data volume; its TLS keys stay out.
- type: volume
source: caddy_data
target: /var/log/caddy
read_only: true
volume:
subpath: logs
# Host journal (sshd), read with journalctl -D
- /var/log/journal:/var/log/journal:ro
# Only Gitea's log folder from its data volume
- type: volume
source: gitea_data
target: /var/log/gitea
read_only: true
volume:
subpath: gitea/log
security_opt:
- no-new-privileges:true
labels:
mag37.dockcheck.update: true
volumes:
crowdsec_config:
crowdsec_data:
caddy_data:
external: true
name: caddy_caddy_data
gitea_data:
external: true
name: gitea_gitea
networks:
default:
external: true
name: {{ docker.network_name }}