Fail2ban is a simple module to protect your server against any bruteforce tentative. It will block an IP for few minutes after too many failed attempt to login.
You can protect your SSH, FTP and other services which use login credentials.
You can configure Fail2ban, to block an IP for a small time, and if there is again some fail from it, to ban it definitively.
To setup it you have two guides from digital ocean :
The fail2ban application monitors server log files for intrusion attempts and other suspicious activity. Fail2ban is primarily focused on SSH attacks, although it can be further configured to work for any service that uses log files and can be subject to a compromise. For setup kindly follow the above guidelines which were posted @VirtuBox