How to Block Specific Countries Using CSF Firewall

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:

  1. Log in to WHM
    how to block countries using CSF Firewall in WHM
  2. Select "Plugins"
  3. Click "ConfigServer Security & Firewall"
  4. Select the "csf" tab
  5. Click "Firewall Configuration"
  6. Scroll down to the Country Code Lists and Settings section
  7. 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.
  8. 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.
  9. Click "Change" at the bottom of the panel
  10. Click Restart csf+lfd to restart the firewall application and complete the change


You now know how to block countries using CSF Firewall in WHM.

  • csf, firewall, block ips
  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

Remove a Service from ChkServd Monitoring for cPanel Servers

This guide requires root user account in server. In some circumstances, ChkservD cPanel...

Assigning a Dedicated IP Address to a Subdomain using WHM

To assign a dedicated IP address to a subdomain, perform the following steps: Step 1: Add the...

Enable Lets Encrypt AutoSSL Provider

This article refers to cPanel version 84 and later. Enable Let's Encrypt for AutoSSL Follow...

How to Fix Incorrect cPanel Account Quotas and Disk Usage

This article will provide a step-by-step guide to fix incorrect account quotas and disk usage on...

How to Uninstall Installatron in WHM cPanel Server

This guide will show you how to quickly uninstall Installatron software from WHM/cPanel server....