Install and Configure CSF firewall on DirectAdmin

In this article, we want to teach you How To Install and Configure the CSF firewall on DirectAdmin.

ConfigServer Firewall (CSF) is a Firewall software installed on your server to keep it secure.

It provides an advanced and easy-to-use web-based interface to manage firewall settings.

Also, you can manage your firewall settings/configuration via the Secure Shell.

How To Install and Configure CSF Firewall on DirectAdmin

To install CSF on DirectAdmin, you need to log in to your server as a root user via SSH.

Then, follow the steps below to install CSF on DirectAdmin.

Set up CSF firewall on DirectAdmin

First of all, you need to install the required packages on your server with the command below:

yum install perl-libwww-perl net-tools perl-LWP-Protocol-https -y

Then, you need to switch to your src directory with the following command:

cd /usr/local/src

Now use the wget command to download the CSF package:


Extract your downloaded file with the command below:

tar -xzf csf.tgz

Next, switch to your CSF directory:

cd csf

Run the CSF script installer with the following command:


When your CSF installation is completed, log in to your DirectAdmin dashboard as an admin user.

Configure CSF from DirectAdmin

At this point, from your DirectAdmin dashboard search for the ConfigServer Security & Firewall. 

Then, find the CSF – ConfigServer Firewall section and click on the firewall configuration.

DirectAdmin firewall configuration

In the IPv4 Port Settings section, you will see that the following ports are opened by default.

CSF ports

Note: If you changed your SSH port number, you need to add this new port on the “IPv4 Port Settings” and/or “IPv6 Port Settings”.

Next, in the initial Settings section. You need to turn off the Testing option. Testing = OFF.

Save your configuration and restart the CSF firewall and LFD on DirectAdmin. You should see that the Firewall Status: Enabled and Running.

restart CSF


At this point, you learn to install and configure CSF on DirectAdmin.

With this firewall service, you can:

  • Control traffic flowing into your server space. Traffic flows in and out through many different connections inside your hosting server. A firewall will close all connections and allow you to selectively open the connections from which you want to receive traffic.
  • Prevent DDoS attacks. You don’t want a hacker to install a DDoS tool on your server. A firewall will prevent that from happening by closing outgoing ports, opening only those needed for authorized outgoing traffic.
  • Track network connections. A firewall like CFS scans all network connections that pass through it and lets you know which ones made a suspicious number of failed login attempts.

Hope you enjoy it.

May this article about Installing the CSF firewall on cPanel be useful for you.

Newsletter Updates

Enter your email address below and subscribe to our newsletter

Stay informed and not overwhelmed, subscribe now!