ConfigServer Security and Firewall (CSF)

How to use CSF Firewall

Firewall Configuration

Csf Requirments

On CentOS/RHEL

yum install -y perl perl-libwww-perl perl-Time-HiRes unzip bind-utils

On Debian/Ubuntu

apt -y install libwww-perl

Install CSF firewall

cd /usr/local/src
wget https://download.configserver.com/csf.tgz
tar -xzf csf.tgz
cd csf
sh install.sh

Configure some basic settings for CSF

/bin/sed -i "s/RESTRICT_SYSLOG\s*=.*$/RESTRICT_SYSLOG = \"3\"/g" /etc/csf/csf.conf
/bin/sed -i "s/SYSLOG_CHECK\s*=.*$/SYSLOG_CHECK = \"3600\"/g" /etc/csf/csf.conf
/bin/sed -i "s/SMTP_BLOCK\s*=.*/SMTP_BLOCK = \"1\"/g" /etc/csf/csf.conf
/bin/sed -i "s/LF_GLOBAL\s*=.*$/LF_GLOBAL = \"1800\"/g" /etc/csf/csf.conf
/bin/sed -i "s/LF_SCRIPT_ALERT\s*=.*$/LF_SCRIPT_ALERT = \"1\"/g" /etc/csf/csf.conf
/bin/sed -i "s/PT_ALL_USERS\s*=.*$/PT_ALL_USERS = \"1\"/g" /etc/csf/csf.conf
/bin/sed -i "s/TESTING = \"1\"/TESTING = \"0\"/g" /etc/csf/csf.conf

Restart csf

csf -r

Block an IP

csf -d IP_ADD

Whitelist an IP

csf -a IP_ADD

Comments

Leave a Reply

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