Wednesday, 12 September 2012

CSF Installation

Pre Setup: Make sure perl modules are installed

yum install -y perl-libwww-perl

Step 1 :  Download, unpack, install of APF from source.

cd /usr/local/src
wget http://www.configserver.com/free/csf.tgz
tar -zxvf csf.tgz
cd csf
./install.sh

Step 1.1: Cleanup source install files.

rm -Rf /usr/local/src/csf* && cd

Step 2: Backup orginal CSF config

cp /etc/csf/csf.conf /etc/csf/csf.conf.bak

Step 3: Edit current CSF config
vi /etc/csf/csf.conf
                                                         
----------------------
csf -x : stop csf
csf -r : restart csf
----------------------



Changing the CSF mode

By default the firewall is running in testing mode(testing= "1"). We have to disable the firewall running in testing mode.
vi /etc/csf/csf.conf
testing = "0"
csf -r

Important Commands: 

csf -d IPADDRESS will deny an IP.
csf -a IPADDRESS will allow an IP.
csf -r will reload all rules.
csf -g IPADDRESSES (will tell you the reason ann IP address is blocked, and if not, will return no reason)

Important files: 

csf.conf   - the main configuration file, it has helpful comments explaining
        what each option does
csf.allow   - a list of IP's and CIDR addresses that should always be allowed
        through the firewall
csf.deny   - a list of IP's and CIDR addresses that should never be allowed
        through the firewall
csf.ignore   - a list of IP's and CIDR addresses that lfd should ignore and not
        not block if detected
csf.*ignore   - various ignore files that list files, users, IP's that lfd
        should ignore. See each file for their specific purpose

No comments:

Post a Comment