How to configure a Firewall for WHM/cPanel


Using a firewall with WHM/cPanel can be confusing and complicated as WHM doesn’t ship with a firewall by default.

The two mainstream Linux distributions, namely CentOS/Redhat and Ubuntu/Debian, also have differing recommended firewall technologies.

CSF & iptables & firewalld

The most popular firewall management utility for WHM appears to beCSF.

The firewall installed on your server will typically be either iptables or firewalld.

You cannot use both iptables and firewalld, and thus have to choose one or the other.

To determine if you’re using iptables or firewalld, issue the following commands:

service firewalld status


iptables -L

iptables is the original tried and tested technology, whereas firewalld seems to be somewhat simpler to understand.

Our recommendation is to install CSF on your WHM server to manage the firewall.

Here are instructions to install CSF taken from the cPanel documentation:

cd /usr/src
rm -fv csf.tgz
tar -xzf csf.tgz
cd csf && ./

Important note for CentOS 7, CloudLinux 7, and RHEL 7 users

The cPanel documentation has the following note:


We recommend that you only use the firewall utilities on CentOS 7, CloudLinux 7, and RHEL 7 servers.

Note the ambiguity with the word 'firewall' above making it very unclear as it could be referencing firewalld as well.

In our experience CSF will use iptables if it’s available on a CentOS 7 installation.

Please a comment below or contact us should you require assistance with your WHM and firewall setup.


How to Configure Your Firewall for cPanel Services

Share this article

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to Top