Fail2Ban
Setup
- Update and install
apt update && apt upgrade -y && apt install -y fail2ban - Start fail2ban and set it to auto start on boot
sudo systemctl start fail2ban && sudo systemctl enable fail2ban - Make a local copy of the config file (why? because jail.conf get wiped after each update)
sudo cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.local - Open jail.local and setup stuff
Actions
Unbanning IP fail2ban-client set YOUR_JAIL_NAME_HERE unbanip IP_ADDRESS
Banning IP fail2ban-client JAIL_NAME banip IP_ADDRESS
Changing max retry attempts
- Open file located at
etc/fail2ban/jail.local - Add
maxretry = xunder[sshd] - Restart fail to ban
sudo systemctl restart fail2ban