strict makes /run read-only, which blocks ufw's /run/ufw.lock and cannot be whitelisted via ReadWritePaths (the file does not exist). full still protects /usr and /etc while leaving /run and /var writable, so only /etc/ufw needs an explicit write path.
777 B
777 B
Fail2ban
Bans brute-force sources via UFW. Reads logs from the systemd journal (backend = systemd), so it works on both Arch and Debian.
Jails
sshdnginx-http-auth
Notes
- Logs to the journal (
logtarget = STDOUTinfail2ban.local) — seejournalctl -u fail2ban. - The systemd unit is hardened (
ProtectSystem=full); the drop-in lives at/etc/systemd/system/fail2ban.service.d/override.confand is fully managed by the role. - Firewall/banaction is UFW on every host; jails ban via
ufw prepend reject.
Variables
See defaults/main.yml.
Verify
sudo fail2ban-client status
sudo fail2ban-client set sshd banip 192.0.2.1 && sudo ufw status | grep 192.0.2.1
sudo fail2ban-client set sshd unbanip 192.0.2.1