Caddy + caddy-defender with automatic scanner blocklisting (auto-blocklist fork)
2.5K
Caddy v2 with the caddy-defender middleware built in, plus automatic scanner blocklisting.
auto-blocklistdocker inspect --format '{{ index .Config.Labels "org.opencontainers.image.revision" }}' cechode/caddy-defender:<tag>.env, .git/, /wp-admin, …) bans the IP before it reaches your app. Works behind auth proxies that answer every probe with a 302./defender/blocklist, /defender/stats, /defender/auto_blocklist/stats, /defender/auto_blocklist/reset/<ip>.Everything from upstream is included: embedded IP ranges (openai, aws, gcloud, azurepubliccloud, datadog, …), file-based blocklists with live reload, and the block / custom / drop / garbage / redirect / ratelimit / tarpit responders.
latest: newest releaseauto-blocklist-vN: pinned releasesexample.com {
defender block {
ranges openai aws gcloud
whitelist 203.0.113.10
blocklist_file /etc/caddy/blocklist/blocklist.txt
auto_blocklist {
enabled
status_codes 404
max_requests 5
window_duration 1m
paths .env .git/ wp-login.php xmlrpc.php phpinfo /wp-admin
}
}
reverse_proxy app:8080
}
services:
caddy:
image: cechode/caddy-defender:latest
ports: ["80:80", "443:443"]
volumes:
- ./Caddyfile:/etc/caddy/Caddyfile
- ./blocklist:/etc/caddy/blocklist # mount the DIRECTORY, not the file
- caddy_data:/data
volumes:
caddy_data:
Mount the directory that holds the blocklist, not the file itself. Blocklist writes use an atomic rename, which fails with EBUSY on a single-file bind mount.
curl -X DELETE localhost:2019/defender/blocklist/198.51.100.7
curl -X DELETE localhost:2019/defender/auto_blocklist/reset/198.51.100.7
Full docs: README · auto-blocklist guide
Content type
Image
Digest
sha256:4d69b0847…
Size
40.6 MB
Last updated
9 days ago
docker pull cechode/caddy-defender