Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Download the file:

Code Block
languagebash
# wget http://configserver.com/free/csf.tgz

Unpack the archive:

Code Block
languagebash
# tar xfz csf.tgz

 

Navigate to the uncompressed csf directory:

Code Block
languagebash
# cd csf


Run the installer:

Code Block
languagebash
# sh install.sh


This will create a configuration file and add all required cPanel services to the allow list.


Next, disable testing mode by editing the main CSF configuration file. Open the file using any editor (vi, nano, etc):

Code Block
languagebash
# nano /etc/csf/csf.conf


Scroll down and find: TESTING = “1” and change to TESTING = “0”

Note: keep the quotations (“”) enclosing the number.


To save, press ‘Ctrl O’.

Hit ‘Enter’ when your screen asks “File Name to Write: /etc/csf/csf.conf”.

Next, hit ‘Ctrl X’ to exit.


When done, restart CSF:

Code Block
languagebash
# csf -r

 

Now CSF is installed and ready. You can simply manage it via cPanel WHM interface WHM > Config Security & Firewall.

OR via command-line:

ALLOW / BLOCK IP with CSF:

In the event that you need to allow/block IP address using command line, the options are as follows:

To add your IP address to a permanent allow list:

Code Block
languagebash
# csf -a 123.45.67.89


To block the IP:

Code Block
languagebash
# csf -d 123.45.67.89

 

To clear blocked IPs:

Code Block
languagebash
# csf -f


Additional Options:

Via Command line you can type: csf -[option]

Commands to Know:

cd = change directory

cd ../ = change up a directory

wget  = fetches a download link

tar  = tar is to uncompress archived files

csf = run commands for the csf firewall followed by an option

ls = list, which shows the contents in the directory you’re in.

pwd = shows the directory you’re currently in.


For more information about CSF, see: http://configserver.com/cp/csf.html

For more information about Basic linux Commands

See: http://www.comptechdoc.org/os/linux/usersguide/linux_ugbasics.html