bug(infra/fail2ban): jail defaults to systemd backend on Debian, never inspects Caddy access log #503
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
infra/fail2ban/jail.d/familienarchiv.confis missingbackend = polling. On Debian/Ubuntu the package ships/etc/fail2ban/jail.d/defaults-debian.confwhich sets[DEFAULT] backend = systemd. Without an override, our jail inherits the systemd backend, reads from journald, and never inspects/var/log/caddy/access.log— i.e. the brute-force protection is inert.Reproduction
On a freshly bootstrapped server (Debian 13 / Ubuntu 24.04, fail2ban from apt, our jail+filter symlinked in):
The jail loads, but it monitors nothing. A real 401 against
/api/auth/loginwould be written to/var/log/caddy/access.logand the jail would never see it.Why the CI test did not catch this
.gitea/workflows/ci.ymlrunsfail2ban-regexagainst a sample line + the filter file. That tests the filter regex in isolation; it never instantiates a real jail with the real defaults-debian.conf inherited backend. So the regex passes (correctly) but the runtime behaviour is broken.Fix
Add a single line to
infra/fail2ban/jail.d/familienarchiv.conf:with a comment explaining why (override the Debian default of
systemd).pollingis the safest choice: no inotify dependency, works on any kernel, slightly higher CPU thanauto/pyinotify(irrelevant for one log file).Also worth adding to the CI test: a
fail2ban-client -d | grep "add.*familienarchiv-auth.*polling"assertion so a future regression is caught.Impact
Discovered
During the production deploy bootstrap for #497 — found after fail2ban came up cleanly but
fail2ban-client get … logpathreturnedNo file is currently monitored.Labels
bug, devops