Fail2ban is a vital security tool that helps protect your server from brute-force attacks. In this guide, we will go through the steps to install and configure Fail2ban alongside Firewalld on Rocky Linux 8.4.
Step 1: Update Your System
Before starting the installation, make sure your system is up to date. Open your terminal and run:
sudo dnf update -y
Step 2: Install Fail2ban
To install Fail2ban, use the following command:
sudo dnf install fail2ban -y
Step 3: Start and Enable Fail2ban
Once the installation is complete, start the Fail2ban service and enable it to start at boot:
sudo systemctl start fail2ban
sudo systemctl enable fail2ban
Step 4: Configure Fail2ban
The default configuration file is located at /etc/fail2ban/jail.conf
. It’s recommended to copy it to jail.local
for custom configurations:
sudo cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.local
Edit the new file with your preferred text editor:
sudo nano /etc/fail2ban/jail.local
Step 5: Install and Configure Firewalld
Ensure that Firewalld is installed and running. If it’s not installed, you can do so with:
sudo dnf install firewalld -y
sudo systemctl start firewalld
sudo systemctl enable firewalld
Step 6: Allow Fail2ban in Firewalld
Add the necessary rules to allow Fail2ban through Firewalld:
sudo firewall-cmd --permanent --add-service=http
sudo firewall-cmd --permanent --add-service=https
sudo firewall-cmd --reload
Step 7: Verify Fail2ban Status
You can check the status of Fail2ban with the following command:
sudo fail2ban-client status
Conclusion
By following these steps, you have successfully installed and configured Fail2ban with Firewalld on Rocky Linux 8.4. This setup will help enhance your server's security by preventing brute-force attacks.
If you're looking for reliable hosting solutions, consider using Windows VPS UK. With Windows VPS, you can ensure optimal performance for your applications. Explore options such as VPS UK Windows or Windows Virtual Private Servers for dedicated resources. For tailored hosting services, visit Windows Virtual Dedicated Server Hosting.
Whether you need UK VPS Windows or Windows VPS Italy, our services provide the performance and reliability you need. Check out Windows VPS Hosting UK for more information.