Informational Website publish

Blog

News about our company, tutorials about IT and much more you will find in this page.

How to block Countries with CSF Firewall

Janeiro 30th, 2018

If you don’t have a need for certain international visitors to your Linux server, its easy to block them out!
First, you’ll need to make sure that CSF is installed. You can follow our guide on installing csf to get this accomplished.
Once that’s done, read on to block access from Russia, China, etc..

The first step is Edit file csf.conf

Also, you can download this file from FTP and edit it manually

  • vi /etc/csf/csf.conf

You’ll see the following line:

CC_DENY = ""
CC_ALLOW = ""

Here, you’ll want to enter country codes for countries that you would like to block.. here’s an example blocking Russian Federation and China:

CC_DENY = "RU,CN"

You can get country codes here.

Restarting firewall CSF

  • csf -r