You can use fail2ban on Linux.
apt install fail2ban
You can manually ban IP addresses with fail2ban-client
or have it automatically ban after X number of failed login attempts.
For the latter, you will have to create a filter config file to tell it where to look for the logs and how to recognize failed login attempts (something like “Authentication finally failed for [username] from [ip address]”), and possibly a jail config file to tell it how to ban the ip addresses.
Fail2ban also works great for blocking ssh password brute-force attempts.
1 Like