Fail2ban
Configuring Fail2Ban for SSH Protection on Ubuntu
Configure Fail2Ban for SSH
sudo apt update
sudo apt install fail2ban -y
fail2ban-client -Vcd /etc/fail2ban
sudo cp jail.conf jail.local
sudo nano jail.localLocate the [sshd] section and configure the following settings:
[sshd]
enabled = true
port = ssh
logpath = /var/log/auth.log
maxretry = 3
bantime = 9999999
findtime = 600Whitelist Trusted IPs (Optional)
sudo nano /etc/fail2ban/jail.localAdd the following under [sshd]
ignoreip = 127.0.0.1/8 <your-trusted-ip>Adjust Firewall Settings
Start and Enable Fail2Ban
Monitor
Last updated