Skip to content

SSH | Fail2Ban

sudo apt update && sudo apt install fail2ban -y
sudo nano /etc/fail2ban/jail.local
[DEFAULT]
# block 12 hours (43200 seconds)
bantime = 43200
#trial time window (10 minutes)
findtime = 600
# max retry
maxretry = 5
# backend log
backend = systemd
# ignore Self IP
ignoreip = 127.0.0.1/8 ::1
[sshd]
enabled = true
port = 22
filter = sshd
logpath = %(sshd_log)s
maxretry = 5
bantime = 43200
sudo systemctl restart fail2ban
sudo systemctl enable fail2ban
sudo fail2ban-client status sshd