Fail2ban is a log-parsing application that protects your server from brute-force attacks by blocking IP addresses that show malicious signs. In this guide, we will walk through the steps to install and configure Fail2ban on AlmaLinux 8.

Step 1: Update Your System

Start by ensuring your system is up to date:

sudo dnf update -y

Step 2: Install Fail2ban

Install Fail2ban using the following command:

sudo dnf install -y fail2ban

Step 3: Start and Enable Fail2ban

Start the Fail2ban service and enable it to run at startup:

sudo systemctl start fail2ban
sudo systemctl enable fail2ban

Step 4: Configure Fail2ban

The main configuration file for Fail2ban is located at /etc/fail2ban/jail.conf. It is recommended to create a local configuration file to override the default settings:

sudo cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.local

Edit the local configuration file:

sudo nano /etc/fail2ban/jail.local

Here, you can configure settings for various services such as SSH. Look for the section related to SSH and enable it:

[sshd]
enabled = true
port = ssh
filter = sshd
logpath = /var/log/secure
maxretry = 5
bantime = 3600

Step 5: Restart Fail2ban

After making changes to the configuration, restart the Fail2ban service:

sudo systemctl restart fail2ban

Step 6: Check Fail2ban Status

You can check the status of Fail2ban and see which jails are currently active:

sudo fail2ban-client status

To check the status of a specific jail (e.g., SSH), use:

sudo fail2ban-client status sshd

Step 7: View Banned IPs

If any IPs have been banned, you can view them with the following command:

sudo fail2ban-client status sshd | grep "Banned IP"

Conclusion

You have successfully installed and configured Fail2ban on AlmaLinux 8. This tool will help protect your server from unauthorized access attempts and enhance your security.

If you're looking for a reliable hosting solution for your Fail2ban setup, consider using Windows VPS UK. With Windows VPS, you can efficiently host your applications and ensure high performance. Whether you need VPS UK Windows or Windows Virtual Private Servers, you'll find a solution that fits your requirements.

For larger deployments or enterprise needs, explore Windows Virtual Dedicated Server Hosting or Virtual Private Server Hosting Windows. Whether you're located in the UK, Italy, or elsewhere, Windows VPS Italy and UK VPS Windows offer reliable hosting options. Visit Windows VPS Hosting UK to discover the best hosting solutions for your Fail2ban deployment.

¿Fue útil la respuesta? 0 Los Usuarios han Encontrado Esto Útil (0 Votos)