This article provides a guide for how to block countries using CSF Firewall.
How to Block Countries Using CSF Firewall
To block countries using CSF's firewall, you can use the "CC_DENY" directive in the CSF configuration to add a country's code:
- Log in to WHM
- Select "Plugins"
- Click "ConfigServer Security & Firewall"
- Select the "csf" tab
- Click "Firewall Configuration"
- Scroll down to the Country Code Lists and Settings section
- Enter the country codes in the "CC_DENY" field, using two-letter ISO 3166-1 alpha-2 codes. For example, "US" for the United States, "GB" for Great Britain, and "DE" for Germany.
- To block multiple countries, separate the codes with commas and leave no spaces. For example, "US,GB,DE" to block the US, Great Britain, and Germany.
- Click "Change" at the bottom of the panel
- Click Restart csf+lfd to restart the firewall application and complete the change
Conclusion
You now know how to block countries using CSF Firewall in WHM.