How to install CSF firewall on cpanel server

CSF firewall is famous free firewall solution that integrates with cPanel very well. It is the most user friendly (in my opinion) firewall and takes only two steps to install and configure.

Login to your server as root and run fullowing commands, you can copy paste all of them all togather.

rm -fv csf.tgz
tar -xzf csf.tgz 
cd csf 

It will download and install ssh and you will get a message looking like this in the end.

*WARNING* TESTING mode is enabled – do not forget to disable it in the configuration
Installation Completed

Next test if you have all the packages installed that are used by CSF, I have found that all the required packages are allready there and test shows success.

perl /etc/csf/

You will see output like below, ignore all messages and check the last line.

Testing ip_tables/iptable_filter…OK
Testing ipt_LOG…OK
Testing ipt_multiport/xt_multiport…OK
Testing ipt_REJECT…OK
Testing ipt_state/xt_state…OK
Testing ipt_limit/xt_limit…OK
Testing ipt_recent…OK
Testing xt_connlimit…OK
Testing ipt_owner/xt_owner…OK
Testing iptable_nat/ipt_REDIRECT…OK
Testing iptable_nat/ipt_DNAT…OK

RESULT: csf should function on this server

Next login to whm and type “fire” in search box, then click “ConfigServer Security & Firewall”. Click firewall configuration button in “csf – ConfigServer Firewall” section. Change value of Testing field to “0”, scroll down to bottom and hit save.

Thats all, I will write about CSF other options that i set on shared cpanel servers.