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

[email protected]:~# apt-get update && apt-get install Fail2ban
[email protected]:~# systemctl enable Fail2ban

CentOS

[email protected]:~# yum install Fail2ban
[email protected]:~# systemctl enable Fail2ban

Enable Fail2ban autostart

Debian/Ubuntu/Raspbian/CentOS

[email protected]:~# systemctl enable Fail2ban

Configure Fail2ban

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