Fail2Ban monitors log files and bans IP addresses that show malicious signs, such as repeated failed login attempts.
Installation
On Debian/Ubuntu:
sudo apt update
sudo apt install fail2ban
On CentOS/RHEL:
sudo yum install epel-release
sudo yum install fail2ban
Basic Configuration
Create a local configuration file:
sudo cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.local
sudo nano /etc/fail2ban/jail.local
Enable the SSH jail:
[sshd]
enabled = true
port = 22
filter = sshd
logpath = /var/log/auth.log
maxretry = 5
bantime = 3600
Start Fail2Ban:
sudo systemctl enable fail2ban
sudo systemctl start fail2ban
Need Help?
If you need assistance configuring Fail2Ban, contact us through the Circle City Servers Support Portal.