How to Block Traffic by Country in the CSF Firewall?

The ability to manage and filter web traffic by country is one of the highly requested features on cPanel servers. Today, we’d show you how to easily do that with ConfigServer Firewall (CSF) plugin in WebHost Manager.

There are a number of reasons why you may want to block traffic from a specific country, including factors such as security issues, ensuring that the content on your website is only visible in certain geographic locations, etc. 

If you wish to block traffic from certain countries, follow the simple procedure we’ve explained below:

 

Step 1: Login to Your WHM Account

To change any settings using Firewall, you’d first have to log into your WHM account.

 

 

Step 2: Open the Firewall Plugin

Once in the WebHost Manager, go to the Plugins in the menu on the left, type “Firewall” in the search field and click on “ConfigServer Security & Firewall”.

 

 

Step 3: Click on the “Firewall Configuration” Button

Now, you’d need to click on the “Firewall Configuration” button in order to open the configuration file.

 

 

Step 4: Go to the “Country Code Lists and Settings” Section

When you’re on the “Firewall Configuration” page, go to the “Country Code Lists and Settings” Section.

 

 

Step 5: Block Traffic by Using the “CC_DENY” Field

Now, Use the “CC_DENY” field in order to block traffic at country level.

Note that the “CC_DENY” field only accepts country names in the two-letter country code form. For instance, if you want to deny access to traffic from the United States, type in the country code US. For blocking traffic from multiple countries, separate the country codes using a comma, but don’t use a space in between, such as ‘US,CN,DE’.

 

 

Step 6: Click on the “Change” Button

After you’ve added the countries, scroll down and click on the “Change” button to save changes.

 

 

Step 7: Click on “Restart csf+lfd”

On the next screen, click on the “Restart csf+lfd” button to restart the firewall with the new changed settings.

 

 

All done!

In case of any confusions, questions, or queries, don’t hesitate to contact us at support@websouls.com. Our customer support executives are available, able, and always ready to help you out!

Want to buy pk domain? Or looking for .com domain registration near you? Contact us and we’d help you close the deal at amazing discounted prices! You can even get a free domain as well as a chance to win a free SSL Certificate from us by buying any of our web hosting plans!

  • whm, Web Hosting in Pakistan, web host manager, Web Hosting, web hosting, WHM, WHMcPanel, whmcpanel, WHMFirewall, Webhostmanager
  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

Can I create my own plan sizes and pricing on my reseller account?

Yes, you can! A Cpanel/WHM reseller account can be set up in a number of different ways....

Can I give SSH to my clients?

No, we don't allow/access you and your clients for server security reasons.

I just added a domain and it doesn't work. Why?

The domains that you add in WHM are still subject to at least 24 to 48 hours propagation time....

What are the POP and SMTP settings for my clients?

The POP and SMTP settings for your clients are mail.domainname.com or the IP address adress...

Can i purchase a dedicated IP for my clients?

Yes. you may place an order for value added features including dedicated IP.