Thursday, October 6, 2022

How to allow/deny traffic by country in CSF firewall via WHM?


We can use a unique country code through the CSF interface in WHM to set server access restrictions by country.
We can write allow or deny rules as required. We can get a list of country codes from: Once the list is obtained, follow the steps below to apply the lock:

  1. Login to WHM as root panel and select from search options ConfigServer security and firewall options.

  2. Scroll down and select the “Firewall Configuration” option from the “csf – ConfigServer Firewall” section.

  3. There you can find the config file, look and find the “Country Code List” and “Settings” in this section.
  4. Scroll down a bit and you can see the “CC_DENY” section. There you can Specify the country code you need to block access to, as shown in the image below:

  5. Multiple countries can be added, separated by commas, without spaces. Example: “AM, BM, CO” Deny access to Armenia, Bermuda, and Colombia countries as follows Pictured:

  6. If we only need to allow a few countries and deny all others, it’s better to use “CC_ALLOW_FILTER”. From there, select the option and enter the list of countries in the same way as described earlier.

  7. After making changes, click the “Change” button below to save the changes, then start a new firewall to apply the new settings.


Related Articles


Please enter your comment!
Please enter your name here

Stay Connected


Latest Articles

- Advertisement -