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

HostSailor

Member
Registered
Joined
May 16, 2014
Messages
20
Points
1
We can make restrictions for the server access based on countries using unique country codes via the CSF interface in WHM.
We can write allow or deny rules based on the requirement. We can get the country code list from: en.wikipedia.org/wiki/ISO_3166-1_alpha-2 Once you have the list, follow the steps provided below to apply the block:
  1. Login to the WHM panel as root and choose the option ConfigServer Security & Firewall using the search option.



  2. Scroll down and select the option 'Firewall Configuration' from 'csf - ConfigServer Firewall' section.



  3. There you can see the configuration file and find the 'Country Code Lists and Settings' from that section.
  4. Scroll down a bit and you can see the 'CC_DENY' section. There you can provide the country codes you need to block the access from as provided in the image below:



  5. Multiple countries can be added with a comma separation with no spaces in between. For example, “AM, BM,CO” deny access to the countries Armenia, Bermuda, and Columbia as shown in the image below:



  6. If we need to allow a few countries only and deny all others, better use 'CC_ALLOW_FILTER' option there and provide the country list in the same way mentioned before.



  7. Once the changes are done, press the 'Change' button at the bottom to save the changes and then restart the firewall to apply the new settings.

 

dedihoster

New member
Registered
Joined
May 22, 2022
Messages
5
Points
1
Good explain
you also can do it from whm also
Method #1 – with cPHulk
cPHulk is the cPanel solution to brute force attacks. To block countries in cPHulk:

1. Log into the WHM installation

2. Navigate to Security Center -> cPHulk Brute Force Protection

3. Here, go to the Countries Management tab.
 
Older Threads
Recommended Threads

Latest Hosting OffersNew Reviews

Sponsors

Tag Cloud

You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an alternative browser.

Top