Install CSF on server

CSF stands for Configserver Security and Firewall which is the most commonly used and popular firewall because it is very user friendly and it provides a cPanel interface to effectively make us of various features of it. CSF is most recommended in cPanel servers which are running without CSF.

Installation

NB: Installation of the CSF requires other firewalls completely if there are any.

  1. Download the package to the server which is available on the CSF website.
    cd /usr/local/src wget <a href="http://www.configserver.com/free/csf.tgz" rel="nofollow">http://www.configserver.com/free/csf.tgz</a>
  2. Extract it.
    tar -zxf csf.tgz cd csf
  3. Run the Install script.
    sh install.sh
    For cPanel Servers :
    sh install.cpanel.sh
    For DirectAdmin Servers :
    sh install.directadmin.sh
  4. Remove APF or IP ables Firewall

The existing IP tables firewall can removed using uninstall scripts located at /etc/csf. For example APF firewall and BFD on the server are removed by the following lines.
sh /etc/csf/remove_apf_bfd.sh

  1. Start the Firewall in Testing Mode

Start the firewall with the following command.
csf -s // start the firewall csf -r // restart the firewall csf -f // flush the rules or stop the firewall.

  1. Specify which ports you want to allow.

To open custom ports other than the default ones, you may have to edit the file /etc/csf/csf.conf and edit the lines with port numbers.

  1. Disable the Testing Mode and Start the Firewall

Firewall is running in testing mode by default settings. You may need to disable the firewall running in testing mode.
vi /etc/csf/csf.conf
Look for the first line and set testing mode to “0”
TESTING = "0"
You may also set the following:
CT_LIMIT = "100" LF_ALERT_TO =(email id of the customer) SYNFLOOD =1
Now restart the firewall!
csf -r

In Cpanel:

The configuration files regarding CSF in cPanle servers are pasted below.
/etc/csf/csf.conf CSF Firewall configuration file /etc/csf/csf.allow =&gt; Config file to allow IPs /etc/csf/csf.deny =&gt; Config file to deny IPs /etc/csf/ =&gt; Alert files with TXT extension are stored within this directory

Uninstall CSF

To uninstall CSF, just run the uninstall script located at the installation directory.
sh /etc/csf/uninstall.sh

That’s it.. 😉

Leave a Reply

Your email address will not be published. Required fields are marked *