How to Configure Firewall CSF on Debian 10

Configure Firewall CSF on Debian 10

In this article, we will have explained the necessary steps to configure Firewall CSF on Debian 10. Before continuing with this tutorial, make sure you are logged in as a user with sudo privileges. All the commands in this tutorial should be run as a non-root user.

Config Server Firewall (CSF) is an open source firewall that can be used in most Linux based operating system to protect servers against unauthenticated users. CSF continuously monitor server’s log file and notify SSH, SMTP, HTTP, IMAP, POP3 and FTP login authentication failures and many protocols. Thhis firewall allows you to manually block and unblock specific IP addresses temporary or permanently.

Configure Firewall CSF on Debian 10

Step 1. The first command will update the package lists to ensure you get the latest version and dependencies.

Step 2. Install CSF Firewall.

First, download the latest version of CSF source from their official website. You can download it with the following command:

Run the CSF Installation Script:

Step 3. Test iptables modules.

Run the csftest.pl perl script to verify if all the required iptables modules are installed on your system:

Step 4. Configuration CSF.

The default CSF configuration file is located at /etc/csf directory. You can configure the required parameters for CSF with the following command:

Save and close the file, when you are finished. Then, start the CSF firewall with the following command:

Step 5. Configure CSF Web Interface.

In this step, we will show you how to enable the CSF Web User Interface. This step is optional and it should be used only if you don’t use a control panel that supports the CSF UI (e.g. WHM/cPanel, DirectAdmin, Webmin, etc.)

After installing all the modules, you will need to enable CSF web UI:

Then, allow access to your IP address with the following command:

Add following line:

Save and close the file. Then, restart LFD service to apply these changes:

Step 6. Access CSF UI.

Now, open your web browser and type the URL http://192.168.0.10:8080.

Congratulation, you have learned how to install and configure Firewall CSF on Debian 10 Buster. If you have any question, please leave a comment below.