Block Countries using CSF Firewall On Linux
By Anuket Jain On 26 November 2015 In Linux
If you don’t have a need for certain international visitors to your Linux server, It is very easy to block countries on your server by using an csf (Config server firewall). There is an option on your csf to block IP range from different countries. You can follow our guide on installing csf If csf is not install.
See Also:
Block Countries using CSF Firewall
In your csf configuration file there is an option to block/allow access from an IP range by using country code. For allowing a country to your server you can use the directive ‘CC_ALLOW‘ from the csf configuration file.
# vim /etc/csf/csf.conf
CC_ALLOW = ""
Similerly you can deny by using the directive ‘CC_DENY‘
CC_DENY = "RU,CN"
In above Example I have blocked China and Russia.
Then, just restart CSF
# csf -r
List of Internet Country Codes
Enjoy it!
Comments
Thank you for this useful article, here’s another tutorial on How To Check Blocked IP In CSF:
http://webhostingway.com/check-blocked-ip-csf/
disclaimer : I’m the writer.
Thanks