We're here to assist with any of your needs, don't hestitate to reach out.
Fail2Ban is a piece of software commonly used to protect servers or websites from brute-force login attacks. It monitors logs of various services (such as SSH, FTP, Apache, etc.) and bans IP addresses that exceed a certain number of failed login attempts.
To install Fail2Ban on CentOS 8, you can follow these steps:
sudo dnf update
sudo dnf install fail2ban
sudo systemctl start fail2ban
sudo systemctl enable fail2ban
Fail2Ban is now successfully installed on your CentOS 8 server. The default configuration file is located at /etc/fail2ban/jail.conf
, and you can customize it according to your needs.
If you want to protect specific services, you can create custom configuration files in the /etc/fail2ban/jail.d/
directory. An example configuration file for securing SSH can be created as follows:
sudo nano /etc/fail2ban/jail.d/sshd.local
Inside the file, you can add the following content:
[sshd]
enabled =true
port = ssh
logpath = %(sshd_log)s
maxretry = 3
Save and exit the file. This configuration will ban IP addresses that have more than 3 failed login attempts for SSH.
You can restart the Fail2Ban service after making any modifications to the configuration files:
sudo systemctl restart fail2ban
That's it! You have now successfully installed and configured Fail2Ban on your CentOS 8 server to protect your website or server from brute-force login attacks.
What our customers say about us
Create your free account today.