Watch this video for a step by step process on How to Set up CSF Firewall to Block Traffic by Country via WHM/cPanel
If you want, you can prevent client requests to the server based on geolocation by configuring the CSF Firewall. In plain English, it is possible to block internet traffic from a country with the help of the CSF Firewall.
In this tutorial, we will show the users with WHM root account the CSF settings to do so.
To Block Traffic by Country
1. Log in to your WHM root account.
2. Select Plugins from the side menu.
3. Click ConfigServer Security & Firewall.
4. Select the csf tab and click Firewall Configuration under the csf-ConfigFirewall section.
The panel for CSF configurations will open.
4. Search and select the Country Code Lists and Settings section.
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.
6. Once you have entered the country codes, click the Change button at the end of the panel.
It will save the changes you made.
7. Click on Restart csf+lfd to restart the Firewall application. It will apply the changes you made to the Firewall.
With this, the CSF Firewall will block traffic from the country or countries you mentioned in the settings.