Fail2ban Configuration for Ubuntu 16.04 LTS Server
This is compilation of several tutorials. Namely:
- How To Protect SSH and Apache Using Fail2Ban on Ubuntu Linux
- Simple fail2ban DOS jail
- How to set up fail2ban to read multi log in a jail?
- Fail2Ban setup
- How to Secure SSH server from Brute-Force and DDOS with Fail2ban (Ubuntu)
For email notifications, see this.
If it's the fresh server installation start with:
sudo apt-get update sudo apt-get dist-upgrade sudo apt-get install fail2ban
Then copy and paste the files from this gist, using commands below:
sudo nano /etc/fail2ban/jail.local sudo nano /etc/fail2ban/filter.d/http-get-dos.conf sudo nano /etc/fail2ban/filter.d/http-post-dos.conf
Use these to check if everything is all right:
sudo systemctl restart fail2ban sudo fail2ban-client status
sudo iptables -S sudo iptables -L