How To Install CSF Firewall on CentOS

Introduction

Config Server Firewall (or CSF) is a free and advanced firewall for most Linux distributions. Except filtering packets – CSF includes other security features, such as login/intrusion/flood detections and server performance monitoring. CSF has it’s own UI, but it is also easily integrated into UI of cPanel, DirectAdmin and Webmin.

CSF is able to recognize many attacks, such as port scans, SYN floods and login brute force attacks on many services. It is usually configured to temporarily block clients who are detected to be attacking the server and after three temporary blocks it becomes permanent block. This behaviour, as well a lot of different configurations can be changed via command line or by using CSF UI.

Full list of CSF abilities and features, as well list of support operating systems can be found here.

Installation

First download CSF
wget http://configserver.com/free/csf.tgz

Unpack archive and navigate to CSF folder The meta description is under 120 characters, however up to 156 characters are available. The available space is shorter than the usual 155 characters because Google will also include the publication date in the snippet.
The keyword / phrase does not appear in the URL for this page. If you decide to rename the URL be sure to check the old URL 301 redirects to the new one!
The copy scores 50.9 in the Flesch Reading Ease test, which is considered fairly difficult to read. Try to make shorter sentences to improve readability.
There are 294 words contained in the body copy, this is slightly below the 300 word recommended minimum, add a bit more copy.

tar -xzf csf.tgz && cd csf

Install CSF
sh install.sh

The firewall is now installed, but you should check if the required iptables modules are available.
perl /usr/local/csf/bin/csftest.pl
The firewall will work if no fatal errors are reported.

If possible, your IP address will be added to the whitelist. Additionaly SSH port has been opened automatically, even if it uses custom port. The firewall was also configured to have testing mode enabled, which means that the iptables rules will be automatically removed five minutes after starting CSF. Now you can configure CSF:
vi /etc/csf/csf.conf

After changing and testing your configuration and you think it is ready for production it is time to disable testing mode. Edit CSF main configuration file and find variable “TESTING”, then change it’s value to “0” and restart CSF with command:
csf -r

CSF UI Preview:

Leave a comment