Erik @ IMH

How to install CSF Firewall on CentOS 7

Archived post, originally published September 14, 2016. Kept for reference — commands and package names reflect the distributions of the time and may have changed.

ConfigServer (CSF) is advanced open-source firewall for Linux. If you are like me, I don't really care much for the native firewalld that's included with RHEL7 releases, and I've used APF for years which is basically just a frontend for iptables.

Here's instructions on how to install it:

1. Disable firewalld

systemctl stop firewalld
systemctl disable firewalld
systemctl mask firewalld

2. Install iptables

yum -y install iptables-services
touch /etc/sysconfig/iptables
touch /etc/sysconfig/ip6tables

3. Start and enable the iptables service

systemctl start iptables
systemctl start ip6tables

systemctl enable iptables
systemctl enable ip6tables

4. Install CSF and its dependencies

yum -y install perl perl-libwww-perl net-tools wget perl-GDGraph perl-LWP-Protocol-https
cd /opt
wget https://download.configserver.com/csf.tgz
tar xzf csf.tgz
cd /opt/csf
sh install.sh
cd /etc/csf
rm -rf /opt/csf

5. Test your kernel modules to ensure everything is OK

perl /usr/local/csf/bin/csftest.pl

That's it, you're done!

You now have a working CSF installation on your server. You should now know the basics on how to configure it. A good place to start is the config file, located at /etc/csf/csf.conf

For more information, please read the full README file available from the vendor's website.