How to Install/Configure Your Firewall for cPanel Services

How to Install/Configure Your Firewall for cPanel Services

ConfigServer & Security Firewall (CSF) is getting more popularity for cPanel servers security. This article will help you for installing and configuring CSF firewall on cPanel servers.

 

 

Download and Install CSF

First download latest source code of CSF firewall and extract on your system using following commands.

# wget http://configserver.com/free/csf.tgz
# tar xfz csf.tgz
# cd csf

After extracting latest code on your system. Execute install.sh script to install CSF on your system. Installer will automatically detect for cPanel server and install required modules for it.

# sh install.sh

Configure CSF

Now edit /etc/csf/csf.conf configuration file and disable TESTING mode by setting value to “0”.

 TESTING = “0”

Let’s restart csf service

# csf -r

Now you can visit to WHM interface Home » Plugins » ConfigServer Security & Firewall to access CSF graphical interface for more configuration options.

 

 

Configure CSF Command Line

We can also manage CSF firewall using command line. For example below is some

To allow an IP. Ip will be added to /etc/csf/csf.allow

# csf -a 11.22.33.44
[or]
# csf --add 11.22.33.44

To deny an IP. Ip will be added to /etc/csf/csf.deny

# csf -d 11.22.33.44
[or]
# csf --deny 11.22.33.44

To search for specific IP, CIDR in iptables rules.

# csf -g 11.22.33.44
[or]
# csf --grep 11.22.33.44

Start the firewall rules

# csf -s
[or]
# csf --start

Flush/Stop firewall rules (Note: lfd may restart csf)

# csf -f
[or]
# csf --stop

Restart CSF firewall rules

# csf -r
[or]
# csf --restart

 

Was this Tutorial helpful? Help others share on Facebook, Twitter, and Google Plus!

 

 
Enjoyed this video?
How to Install/Configure Your Firewall for cPanel Services
"No Thanks. Please Close This Box!"