Server Administration & Management

How to allow only specific countries with CSF

Login to WHM-cPanel configuration via WHM

1. WHM
2. Plugins
3. ConfigServer Security & Firewall
4. Firewall Configuration)


1. Login via SSH

# vi /etc/csf/csf.conf

What you are looking for is “CC_ALLOW_FILTER

First, you will want to get a list of ISO Country Codes to allow.

http://www.countryipblocks.net/country-blocks/ “OR”

http://www.ipdeny.com/ipblocks/ “OR”


For example, if you only wanted United States, Canada, Great Britian, Australia, and Mexico to be whitelisted, you would specify:


What this will do is download a list of IP ranges belonging to those countries, then add them to a whitelist, and deny everything else, that is, deny all other countries’ IP ranges. So, India will not be able to connect to your server, Russia will not be able to connect, etc..

Once you have change this in your configuration, don’t forget to restart your firewall to apply the new configuration.

April 30, 2011 - Posted by | CSF, Firewall, Security | , , ,


  1. Your ability to convey these kinds of data is just the thing every one of us have to have. By simply discussing your understanding you help others via expressing your own personal experience. And I will let you know now your article served me.

    Comment by fresh water | June 15, 2011 | Reply

  2. Thanks for making the effort to line this all out for people like us. This particular blog post ended up being really useful if you ask me.

    Comment by Jonnie Deible | June 15, 2011 | Reply

  3. Your ability to communicate this kind of info is just the thing many of us want. Simply by sharing your understanding you aid other folks via sharing your very own experience. And I will tell you right now your writing assisted me.

    Comment by amazing water filter | June 16, 2011 | Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: