Download latest CSF & LFD from https://download.configserver.com/csf.tgz, extract it and install it:
# wget https://download.configserver.com/csf.tgz # tar -xzf csf.tgz# cd csf# ./install.sh
Test CSF & LFD installation
Testing
# perl /usr/local/csf/bin/csftest.plTesting ip_tables/iptable_filter...OKTesting ipt_LOG...OKTesting ipt_multiport/xt_multiport...OKTesting ipt_REJECT...OKTesting ipt_state/xt_state...OKTesting ipt_limit/xt_limit...OKTesting ipt_recent...OKTesting xt_connlimit...OKTesting ipt_owner/xt_owner...OKTesting iptable_nat/ipt_REDIRECT...OKTesting iptable_nat/ipt_DNAT...OKRESULT: csf should function on this serverRemove other firewall that may conflict by running script
# /usr/local/csf/bin/remove_apf_bfd.shRemoving apf and/or bfd.../usr/local/csf/bin/remove_apf_bfd.sh: line 5: apf: command not founderror reading information on service apf: No such file or directoryerror reading information on service apf: No such file or directory...Done
Removing "Testing" mode
# vi /etc/csf/csf.conf
...
TESTING = "0"
...
Block country by adding 2 letters country code in csf.conf and restart
# vi /etc/csf/csf.conf
...
CC_DENY = "CN,VN"
...
# csf -r
Country code can be found https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2
References:
- https://download.configserver.com/csf/install.txt