Block Country in CSF firewall

CSF firewall can block all traffic from a country or list of countries using the GeoIP database.

To block a country, edit the file

/etc/csf/csf.conf

Find

CC_DENY=""

Replace with

CC_DENY="2_LETTER_COUNTRY_CODE"

Here is an example to block all traffic from China

CC_DENY="CN"

If you want to block another country, you can add it like

CC_DENY="CN,RU"

Now restart CSF firewall with

csf -r

See CSF firewall

Need help with Linux Server or WordPress? We can help!

Leave a Reply

Your email address will not be published. Required fields are marked *