Install needful packages if you haven’t yet
yum install wget vim perl-libwww-perl.noarch perl-Time-HiRes -y
Download and install CSF
cd /usr/src/ wget https://download.configserver.com/csf.tgz tar -xzf csf.tgz cd csf sh install.sh
Run test:
cd /usr/local/csf/bin/ perl csftest.pl
Disable default Centos 7 firewall if you have it installed
systemctl stop firewalld systemctl disable firewalld
Disable testing mode
cd /etc/csf/ vim csf.conf
from TESTING = "1" to TESTING = "0"
Update TCP_IN with needful ports, for example
TCP_IN = "22,53,80,443,3306"
Restart CSF
csf -r