A determined attacker may try to brute force a user's password to gain access or attempt repeated logins to consume network and system resources as part of a denial of service attack. Fail2ban can help protect you from such attacks by monitoring a server's log files, identifying suspicious activity, and automatically banning the IP addresses responsible for the activity. This recipe teaches you how to install Fail2ban to safeguard your system.
This recipe requires a CentOS system running the OpenSSH server. Administrative privileges are also required, either by logging in with the root
account or through the use of sudo
. The fail2ban
package is hosted by the EPEL repository; if the repository is not already registered, refer to the Registering the EPEL and Remi repositories recipe in Chapter 4, Software Installation Management.