Interview Prep/Linux/SSH & Access Hardening

What is fail2ban and how does it work?

BeginnerProductionSSH & Access Hardening
Answer

fail2ban watches logs (files or the journal) for failure patterns defined in filters, and when an IP exceeds maxretry within findtime, it runs an action, usually adding a firewall ban for bantime.

# /etc/fail2ban/jail.local
[sshd]
enabled  = true
backend  = systemd
maxretry = 5
findtime = 10m
bantime  = 1h
sudo fail2ban-client status sshd
sudo fail2ban-client set sshd unbanip 203.0.113.7
All Linux questions Roadmap: Linux

More on SSH & Access Hardening