Firewall Configuration for cPanel & WHM Services

This guide provides a complete reference for configuring firewall rules for cPanel & WHM servers. It includes all required ports, inbound/outbound rules, security recommendations, license callback behavior, WebPros service IPs, and practical examples for CSF, iptables, and nftables.

cPanel Firewall PortsWHM Firewall ConfigurationCSF iptables nftables

~3 min read · Updated Feb 18, 2026

1. Introduction


cPanel & WHM relies on many services that require external connectivity, including WHM, cPanel, Webmail, FTP, SMTP, IMAP, DNS, and licensing. If your firewall (CSF, firewalld, iptables, or your hosting provider’s firewall) blocks these ports, access to the panel, email, websites, and even the cPanel license system will fail.


Golden Rules:

  • Only open the ports you actually use.
  • Always keep emergency access (KVM/Console) available.
  • If you install a third‑party firewall (CSF/APF), WHM’s Host Access Control rules are ignored.

2. Required Ports for cPanel & WHM


The table below lists the essential ports, protocols, direction, and important notes.


PortServiceTCPUDPDirectionLocal Only?Description
1CPANOutboundNoUsed for Perl module updates
7RazorOutboundNoSpamAssassin spam checks
20FTP DataInboundNoUse SFTP instead; FTP is insecure
21FTP ControlInboundNoSFTP recommended
22SSHInboundNoRequired for secure server access
25SMTPIn/OutNoEmail sending/receiving
53DNSIn/OutNoRequired for DNS, AutoSSL
80HTTPInboundNoRedirect users to HTTPS
443HTTPSInboundNoMain SSL port
465SMTP SSLInboundNoSecure email sending
587SubmissionInboundNoClient email submission
993IMAP SSLInboundNoSecure email retrieval
995POP3 SSLInboundNoSecure POP3
2083cPanel SSLInboundNoMain cPanel port
2087WHM SSLInboundNoMain WHM port
2096Webmail SSLInboundNoMain Webmail port
2089License CheckOutboundNoRequired for cPanel license validation

3. License Callback Mechanism


To update license status instantly, cPanel attempts outbound connections on these ports (in order):


  • 2082 – cPanel
  • 2083 – cPanel SSL
  • 2086 – WHM
  • 2087 – WHM SSL
  • 2096 – Webmail SSL

At least one of these must be open outbound.


4. Required IPs for WebPros Features


4.1 SEO Scanner IPs



78.138.117.141
78.138.117.142
78.138.117.168
78.138.117.169
78.138.117.179
78.138.117.180
78.138.117.214
78.138.117.215

4.2 Site Quality Monitoring


Uses AWS IP ranges. Retrieve the full list:


curl https://ip-ranges.amazonaws.com/ip-ranges.json

5. Firewall Configuration Examples


5.1 CSF (Recommended for cPanel)



tcp|in|d=2087|s=0.0.0.0/0
tcp|in|d=2083|s=0.0.0.0/0
tcp|in|d=2096|s=0.0.0.0/0
tcp|in|d=993|s=0.0.0.0/0
tcp|in|d=465|s=0.0.0.0/0
tcp|in|d=22|s=0.0.0.0/0

5.2 nftables (AlmaLinux / Rocky / CloudLinux)



nft add rule inet filter input tcp dport 2087 accept
nft add rule inet filter input tcp dport 2083 accept
nft add rule inet filter input tcp dport 2096 accept

5.3 iptables (Ubuntu or older systems)



iptables -A INPUT -p tcp --dport 2087 -j ACCEPT
iptables -A INPUT -p tcp --dport 2083 -j ACCEPT

6. Conclusion


Proper firewall configuration ensures stable operation of cPanel & WHM services, prevents unexpected outages, and maintains secure access. This guide provides all essential ports, required IPs, and practical examples for the most common firewall systems.


Written & researched by Dr. Shahin Siami

Related Articles

How to Restore Your cPanel Account: A Complete Guide for New System Administrators

This guide explains how new system administrators can restore a cPanel account using WHM, transfer accounts and configurations between servers, and enable diagnostic logging for transfer and restore operations. It covers essential concepts such as WHM vs. cPanel, root access, backup handling, SFTP uploads, transfer methods, and advanced debugging tools.

Continue

آموزش کامل انتقال تمام اکانت‌های cPanel از یک سرور به سرور دیگر

این مقاله نحوه انتقال همه اکانت‌های cPanel، تنظیمات سرویس‌ها، گواهی‌های SSL و IP اصلی سرور را از یک سرور قدیمی (Source) به یک سرور جدید (Target) توضیح می‌دهد. شامل نصب سرور جدید، انتقال تنظیمات، انتقال اکانت‌ها، تغییر IP، تنظیم DNS و نصب مجدد SSL است.

Continue

How to Migrate a WordPress® Installation to a cPanel & WHM Server

This guide explains how to migrate a WordPress installation from a macOS-hosted environment to a cPanel & WHM server. It covers exporting the database, uploading WordPress files, creating and importing a MySQL database, updating URLs, configuring wp-config.php, fixing broken links, and finalizing the migration.

Continue

How to Manually Transfer an Account Between Servers in cPanel & WHM

This article explains how to manually transfer a cPanel account between servers when the account is too large for WHM’s automated transfer tools. It covers creating temporary directories, compressing public_html and log files, securely transferring data with SCP, and restoring the files on the destination server.

Continue

How to Manually Migrate Horde Calendars and Contacts to Roundcube in cPanel & WHM

This article explains how to manually migrate Horde calendars and contacts to Roundcube in cPanel & WHM version 108 through 118. It covers exporting Horde data, placing it in the correct directories, and importing it into Roundcube using built‑in plugins or manual import tools.

Continue

How to Manually Migrate Accounts to cPanel & WHM from Unsupported Control Panels

This article explains how experienced system administrators can manually migrate accounts from unsupported third‑party control panels to cPanel & WHM. It covers pre‑migration steps, installation requirements, file and directory transfers, database restoration, SSL migration, and post‑migration tasks.

Continue