Skip to content
Witen

Warden

Block repeat web scanners using Caddy access logs

Write Caddy access logs in JSON, verify Warden is reading them, and confirm when repeated scanner activity becomes a firewall ban.

Write a Caddy access log in JSON

These steps use Caddy on a Linux host with Warden installed. See the Warden installation guide for packages and service setup.

Add a log directive inside the site block you want to watch. Use an existing JSON access log if the site already has one. Keep your existing site handlers in place.

log {
	output file /var/log/caddy/access.log
	format json
}

Confirm the Caddy service can write the log and that Warden can read the file and traverse its directory. Use a scoped group or ACL that also covers files created during rotation. Keep access logs private and leave Caddy's default credential redaction in place.

Validate and apply the Caddyfile using your service's configured account and path. On a packaged systemd installation running as caddy, use:

sudo -u caddy caddy validate --config /etc/caddy/Caddyfile --adapter caddyfile
sudo systemctl reload caddy

Send one normal request to the site and confirm a new JSON record appears in the selected file. For changes to an existing file output's options, check Caddy's restart and rotation guidance. See the Caddy access log reference.

Verify Warden is reading the log

Add the file once in /etc/witen/warden.toml. Use the exact path written by Caddy.

[[logs]]
path = "/var/log/caddy/access.log"
type = "caddy"
  1. For a new pilot, keep the null backend under [jail] to observe routine traffic before turning on bans. Keep existing protection in place on production hosts.
  2. Validate the Warden configuration, then restart Warden so it opens the new source. The commands below use systemd. Use your normal service manager where it differs.
sudo warden validate --config /etc/witen/warden.toml
sudo systemctl restart witen-warden
sudo warden sources --json

Make another normal request and check the source again. Look for the path in target, a growing position in bytes, and any last_error. If the position stays still, check that the request reached the configured site, the file is growing, and Warden's service user can still read it after rotation. The Warden service journal can show why the source failed to open.

Verify detection and firewall enforcement

Review recent classified events and the HTTP jail's settings. A normal request checks collection. Scanner detection depends on the request pattern and configured thresholds. A 404 by itself does not establish scanner activity.

sudo warden events --limit 50 --json
sudo warden stats --json
sudo warden actions --jail http --limit 20 --json
sudo warden blocked --source local --json
  • Check the event for the address, timestamp, and reason. In observation mode, use the event to validate classification and source attribution.
  • When ready, use Warden's firewall setup to enable enforcement with your management address protected. In enforcement mode, check the action journal and active local bans when one address reaches the threshold.
  • To verify an active firewall drop, check the Warden firewall counters alongside the recorded action. A request dropped by the firewall never reaches Caddy, so its new access-log record will be absent.

For Caddy on a Docker bridge, also verify the published-port firewall path from a separate client.