How to Block Traffic by Country in the CSF Firewall

We can block traffic by country for the websites hosted on WHM & cPanel with the ConfigServer Security Firewall (CSF) Plugin. I had a client who needs to block certain countries with enabling this feature. This post will explain the steps to enable this feature.

Step 01 – Login to WebHost Manager and navigate to Home >> Plugins >> ConfigServer Security & Firewall section. Then click on the csf tab and click Firewall Configuration button under the section of csf – ConfigServer Firewall.

Step 02 – Choose Country Code Lists and Settings from the drop down menu. Next find the CC_DENY section and add the country codes that you need to block.

You may find a list of ISO 3166-1 alpha-2 codes at https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2

Multiple countries can be added with comma separated with no spaces in between, such as “CN,RU,BR,TR,LT” to deny access for the countries China, Russia, Brazil, Turkey and Lithuania as in my example below.

Step 03 – Scroll down to the bottom of the page and click Change button to save the settings.

Step 04 – Changes has been saved. Click Restart csf+lfd button to restart the Firewall.

That’ it. 😉

Rating: 3.2/5. From 3 votes.
Please wait...

You may also like...

Leave a Reply

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

How to Block Traffic by Country in the CSF Firewall

time to read: 1 min
0