Skip to content

Instantly share code, notes, and snippets.

@pldubouilh
Created December 23, 2018 15:05
Show Gist options
  • Save pldubouilh/30ed837d8e1659ea188ace5618352283 to your computer and use it in GitHub Desktop.
Save pldubouilh/30ed837d8e1659ea188ace5618352283 to your computer and use it in GitHub Desktop.
fail2ban filter for http 401
# lives in filter.d/
[Definition]
failregex = ^<HOST> -.* HTTP/[0-9].[0-9]" 401
ignoreregex =
[caddy]
enabled = true
filter = caddy
logpath = /var/log/caddy_access_logs
banTime = 3600
findTime = 600
maxretry = 5
@JohnNeville
Copy link

What are you using for your caddyfile config to generate /var/log/caddy_access_logs?

@pldubouilh
Copy link
Author

log /var/log/caddy_access_logs {
 rotate_size 30
}

that's what I use - I think that's the old caddy syntax, if you have the new syntax at hand I'd be interested :)

@noerw
Copy link

noerw commented Jul 5, 2021

Caddy 2 has deprecated common log format, superseeded by a structured log pipeline.
For now the old standard log format is still accessible via

log {
  output file /var/log/access.log
  format single_field common_log
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment