Harden against bot floods and add post-provisioning service check
- Traefik rate-limits all routes (60 req/min standard, 300 for Nextcloud) and writes access logs to /var/log/traefik/access.log - Fail2ban watches Traefik access logs and bans IPs after 10 x 403/404 within 60 s for 24 h - Nextcloud html directory created as www-data (UID 33) so Apache can process .htaccess and serve requests correctly - scripts/check-services.sh verifies all seven endpoints return the expected HTTP status after provisioning
This commit is contained in:
@@ -11,6 +11,7 @@ services:
|
||||
- /var/run/docker.sock:/var/run/docker.sock:ro
|
||||
- {{ traefik_data_dir }}/traefik.yml:/traefik.yml:ro
|
||||
- {{ traefik_data_dir }}/acme.json:/acme.json
|
||||
- /var/log/traefik:/var/log/traefik
|
||||
networks:
|
||||
- traefik_public
|
||||
labels:
|
||||
@@ -22,6 +23,15 @@ services:
|
||||
- "traefik.http.routers.dashboard.service=api@internal"
|
||||
- "traefik.http.routers.dashboard.middlewares=dashboard-auth"
|
||||
- "traefik.http.middlewares.dashboard-auth.basicauth.users={{ traefik_dashboard_users }}"
|
||||
# Rate-limit middlewares — referenced by services as rate-limit@docker / rate-limit-lax@docker
|
||||
# Standard: 60 req/min per IP, burst 20 — protects all services from bot floods
|
||||
- "traefik.http.middlewares.rate-limit.rateLimit.average=60"
|
||||
- "traefik.http.middlewares.rate-limit.rateLimit.period=1m"
|
||||
- "traefik.http.middlewares.rate-limit.rateLimit.burst=20"
|
||||
# Lax: 300 req/min per IP, burst 100 — for Nextcloud sync clients making many small requests
|
||||
- "traefik.http.middlewares.rate-limit-lax.rateLimit.average=300"
|
||||
- "traefik.http.middlewares.rate-limit-lax.rateLimit.period=1m"
|
||||
- "traefik.http.middlewares.rate-limit-lax.rateLimit.burst=100"
|
||||
|
||||
networks:
|
||||
traefik_public:
|
||||
|
||||
@@ -9,7 +9,9 @@ api:
|
||||
log:
|
||||
level: INFO
|
||||
|
||||
accessLog: {}
|
||||
accessLog:
|
||||
filePath: /var/log/traefik/access.log
|
||||
bufferingSize: 100
|
||||
|
||||
entryPoints:
|
||||
web:
|
||||
|
||||
Reference in New Issue
Block a user