What is fail2ban?

We install fail2ban to protect the server from attacks and automatically block IP adresses. If you want further information please check the Wikipedia page.

Tasks

  • Install Fail2ban
  • Enable Fail2ban autostart
  • Configure Fail2ban

Install Fail2ban

Debian/Ubuntu/Raspbian

root@cloudserver:~# apt-get update && apt-get install Fail2ban
root@cloudserver:~# systemctl enable Fail2ban

CentOS

root@cloudserver:~# yum install Fail2ban
root@cloudserver:~# systemctl enable Fail2ban

Enable Fail2ban autostart

Debian/Ubuntu/Raspbian/CentOS

root@cloudserver:~# systemctl enable Fail2ban

Configure Fail2ban

Now proceed to configure fail2ban. The config files can be found here