- crowdsec stack on lava reading Caddy's access log (logs/ subpath only), collections caddy, http-cve, base-http-scenarios, appsec-virtual-patching; AppSec listener on :7422; allowlist for lava, Tailscale, the server - caddy_custom switch (image + plugin directives), staged by caddy_crowdsec_enforce / caddy_appsec / caddy_ratelimit; all off, so the rendered config is unchanged in effect - (protect) on every site, (ratelimit_login) on login paths, both empty until enabled; caddy recreated when compose.yml or .env changes Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
42 lines
1.2 KiB
Django/Jinja
42 lines
1.2 KiB
Django/Jinja
# CrowdSec: reads Caddy's JSON access log, decides which IPs to ban, and
|
|
# serves those decisions (LAPI :8080) and AppSec checks (:7422) to Caddy over
|
|
# lava. Nothing is published to the host.
|
|
services:
|
|
crowdsec:
|
|
image: crowdsecurity/crowdsec:{{ crowdsec_version | default('latest') }}
|
|
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
|
|
TZ: Etc/UTC
|
|
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
|
|
security_opt:
|
|
- no-new-privileges:true
|
|
labels:
|
|
mag37.dockcheck.update: true
|
|
|
|
volumes:
|
|
crowdsec_config:
|
|
crowdsec_data:
|
|
caddy_data:
|
|
external: true
|
|
name: caddy_caddy_data
|
|
|
|
networks:
|
|
default:
|
|
external: true
|
|
name: {{ docker.network_name }}
|