caddy: caddy not logging basic authentication failures
relates to #2402 which was implemented Feb 2019 pre-v2.
when using basicauth to authenticate it would be nice to use fail2ban to detect multiple failed login attempts and ban ip addresses. this is difficult with the current logging since every basic authentication attempt starts with a 401 and thus banning on this results in many false positives.
see #2402 for further details and reasoning.
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 1
- Comments: 26 (13 by maintainers)
Commits related to this issue
- caddyauth: Debug log for failed attempts (closes #3363) — committed to caddyserver/caddy by mholt 7 years ago
- caddyauth: Debug log for failed attempts (closes #3363) — committed to caddyserver/caddy by mholt 7 years ago
- basicauth: Emit specific log based on type of auth failure (#3363) — committed to caddyserver/caddy by mholt 6 years ago
@sumnerboy12 You had the actual use case for it. We’re not going to implement a new feature just because. Since it is no longer required, it will not be implemented. My time must be spent on things that will make a difference to the project and its users, not “nice to haves” (especially when they take so much time like this feature).
Technically you don’t know the identity, because they haven’t successfully authenticated. You have a username, but that’s not enough to say that you know who it is.
401is definitely the correct status code to return on a failed authentication.https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/401
What if they’re like me and type their password wrong twice? 😛
I guess I’m just trying to see the need to motivate a change in Caddy. AFAICT everything is working as expected, it’s just that your fail2ban is too strict probably.
yes - agree it is the correct behaviour, and then if an actual authentication attempt fails we also get a 401 (again correct).
however trying to configure
fail2banto ban on just the 401s results in false positives since every time an authentication attempt is started a 401 is logged and this eventually triggers the ban.so ideally we have some specific auth failed logging which
fail2bancan monitor instead of the 401s.hope that is a little clearer…