Step 5: Setup fail2ban
We are now going to setup fail2ban, basically something than bans IPs from accessing your server if they fail to authenticate multiple times.
Installing
Installation varies from distro to distro, here you can check how.
Configuration
We are going to setup fail2ban to check ssh connections. You can configure it for many many things, even custom ones.
You can add this to /etc/fail2ban/jail.d/jail.local:
[sshd]
enabled = true
Restart fail2ban with sudo systemctl restart fail2ban, and it should work!