How to Set up CSF Firewall to Block Traffic by Country via WHM/cPanel?

Optionally, you can block geolocation-based client requests to the server by configuring the CSF Firewall. Generally speaking, a CSF Firewall can help block Internet traffic from a country.

In this tutorial, we are going to show CSF structures for those calculated with WHM roots.

To Block Traffic by Country

1. Go to your WHM root calculation.

2. Select Plugins from the side menu.

https://www.milesweb.in/hosting-faqs/wp-content/uploads/2021/08/whm_plugins.png

3. Click ConfigServer Security & Firewall.

https://www.milesweb.in/hosting-faqs/wp-content/uploads/2021/08/whm_configserver_security_firewall.png

4. Select the csf tab and click Firewall Configuration under the csf-ConfigFirewall section.

https://www.milesweb.in/hosting-faqs/wp-content/uploads/2021/08/whm_configserverwhm_configserver_security_firewall_csf-min.png

The CSF configurations panel will pop up.

4. Go to the Country Code Lists and Settings section by searching for it.

5. Enter the country codes in the CC_DENY field to block their traffic.

You can refer to this link ISO 3166-1 alpha-2 to find the country codes you are looking for.

https://www.milesweb.in/hosting-faqs/wp-content/uploads/2021/09/whm_csf_block_cc.png

6. After entering the country codes, click the Change button at the end of the panel. It will save the changes you make.

 

7. Click Restart csf+lfd to restart the Firewall application. It will apply the changes you made to the Firewall.

https://www.milesweb.in/hosting-faqs/wp-content/uploads/2021/08/whm_restart_csf_ifd.png

Using this, the CSF Firewall will block traffic from the country or countries you specify in the settings.




Was this article helpful?

mood_bad Dislike 0
mood Like 0
visibility Views: 133