Hardening a cPanel/WHM server: a maintenance and security checklist
In this article11 sections
A cPanel/WHM server is a high-value target. It holds many websites, many mailboxes and often many customers, behind one set of login pages on well-known ports. Attackers scan for exactly this, and a single weak account, outdated script or exposed service can turn into a server-wide problem: spam blasts that get your IP blocklisted, defaced sites, stolen data, a suspended server.
This checklist is for people who run their own cPanel/WHM server: hosting resellers, agencies hosting client sites, businesses with a VPS or dedicated machine. It is ordered by effect: the first items stop the most common attacks. Menu names in WHM move between versions, so search for the name in WHM’s top-left search box, and treat cPanel’s documentation for your version as the final reference.
1. Keep everything patched, on purpose
cPanel itself. In WHM, open Update Preferences and choose a release tier that suits you (a long-term tier changes less often, which is usually what a production server wants). Make sure automatic updates are on, and check the update log occasionally: a failed update that nobody noticed is a common reason servers are behind.
The operating system. cPanel runs on supported distributions (AlmaLinux and Rocky Linux, CloudLinux, and current Ubuntu LTS releases at the time of writing; confirm the list for your version). Apply operating system updates on a schedule, and reboot for kernel updates in a maintenance window:
sudo dnf upgrade --refresh # AlmaLinux / Rocky / CloudLinux
sudo apt update && sudo apt upgrade # Ubuntu
sudo needs-restarting -r # RHEL family: tells you if a reboot is required
PHP. Open EasyApache 4 and the MultiPHP Manager. Remove versions that no longer receive security fixes, set a sensible default, and move accounts forward in a planned way, not on the day a version disappears. Where possible use PHP-FPM, which isolates and limits each account’s PHP processes.
Applications inside accounts are the biggest source of compromises. Outdated WordPress, plugins and scripts are how most servers get hurt. Encourage updates, and scan for old versions regularly (see below).
2. Lock down who can log in
- Two-factor authentication for WHM and cPanel. WHM has a two-factor setting in the Security Center. Turn it on for root and every reseller, and encourage customers to enable it for cPanel.
- SSH by key only, no password logins, no direct root login if you can avoid it. See the guide to hardening SSH on Ubuntu: the sshd settings are the same on other distributions.
- cPHulk Brute Force Protection (WHM, Security Center) blocks repeated failed logins to WHM, cPanel, mail and SSH. Enable it, whitelist your own addresses, and review its blocks.
- Restrict the management ports (WHM on 2087 and 2086, cPanel on 2083 and 2082, and SSH) to known addresses at the firewall where your team has fixed addresses. If customers need cPanel from anywhere, restrict at least WHM.
- Review accounts and API tokens: remove resellers and tokens that are not used. Give each administrator their own login rather than sharing root.
3. The firewall question
For years, the standard firewall on cPanel servers was ConfigServer Security & Firewall (CSF) with its login-failure daemon. ConfigServer closed on 31 August 2025, and the original project is no longer maintained there. cPanel has said it publishes and maintains its own fork focused on critical security and stability fixes. If your server runs CSF, find out which version and source it updates from, and follow cPanel’s documentation on its status, because a firewall that is not updated is a risk of its own.
Whatever product you use, the rules stay the same:
- Default deny for incoming connections, with explicit allows only for the ports you serve (80, 443, mail ports if you host mail, SSH, and the panel ports as restricted above).
- A provider-level firewall (a cloud security group or a hosting provider’s firewall) in front of the server, as a second layer.
- No database port exposed. MySQL on 3306 should listen on the local machine only, unless you have a specific, protected need.
- List what listens:
sudo ss -tulpn. Anything you cannot explain gets closed or investigated.
A commercial security suite such as Imunify360 includes its own firewall and intrusion prevention; evaluate it against your budget and your support needs.
4. ModSecurity, started carefully
ModSecurity is a web application firewall that inspects requests. In WHM, the ModSecurity tools (under Security Center) let you install a rule set from a vendor, including the OWASP Core Rule Set. Rules help against common attacks, and they can also block legitimate requests (“false positives”). The safe sequence:
- Install the engine and a rule set, and start in detection-only mode, so it logs but does not block.
- Watch the logs for a week and note which rules trigger on legitimate traffic (checkout forms, admin pages, API calls).
- Add exceptions for those, then switch to blocking.
- Re-check after big changes to a customer’s site, and keep the rule set updated.
5. Isolate accounts from each other
On a shared server, one compromised account should not be able to read or damage the others.
- CloudLinux (a commercial distribution) adds CageFS, which gives each account its own view of the filesystem, and LVE limits on CPU, memory, I/O and processes, so one noisy account cannot take the server down. It is the strongest isolation available for shared hosting.
- Jailed shell access: give shell access only to accounts that need it, and jail those. In WHM, manage shell access under the account tools.
- Symlink and
open_basedirprotections: enable the options in WHM that stop accounts following symbolic links into other accounts’ files and limit PHP to the account’s own folders. - Separate heavy or high-risk accounts onto their own server or plan.
6. Control outgoing mail
A server that sends spam is quickly blocklisted, and then none of your customers’ mail arrives. Set limits and watch them:
- Hourly send limits per domain and per account (look for the “maximum emails per hour” setting in WHM’s Tweak Settings and Mail options).
- SPF and DKIM on for every domain (WHM’s Email Deliverability tool shows which domains lack them), and a PTR record for the server’s IP, set at the provider.
- Watch the queue: WHM’s Mail Queue Manager, or
exim -bpcon the command line. A queue that suddenly grows means a compromised account or script. - Check blocklist status of your IPs regularly, and keep your abuse contact working.
The guide to reading email bounces shows how to trace delivery failures.
7. Scan for malware and problems
- Run WHM’s Security Advisor (in the Security Center) and work through what it reports. It checks common misconfigurations and is a quick, free way to find gaps.
- Scan accounts for malware with a scanner that updates its signatures (ImunifyAV, or ClamAV through a cPanel plugin). Review what it finds; do not auto-delete without understanding why a file was flagged.
- Watch processes and load for the signs of abuse: unknown processes, outbound floods, unexpected cron jobs.
- When an account is hacked, follow a structured cleanup (see the cleanup runbook for hacked WordPress sites) and find the entry point.
8. Backups you have actually restored
- Configure WHM backups (Backup Configuration), with a remote destination, not only the same server’s disk. Choose a retention that fits your promises to customers.
- Include configuration, not just accounts: keep a copy of the server’s own settings, because rebuilding them from memory is slow.
- Restore a test account to a spare location every few months, and time it. The first time you restore should not be during an outage.
- Monitor the backup job: an email on failure, and a check that last night’s backup exists.
9. Monitoring and alerts
- cPanel’s service monitor (
chkservd) restarts failed services and sends notifications. Set the notification contacts in WHM so they reach someone who will read them. - External uptime monitoring of your own sites and of the panel, because a server cannot report that it is down. See the guide on monitoring a small server.
- Disk and inode alerts at 80% and 90% (the guide on finding what is eating your disk shows how to respond).
- Certificate expiry: AutoSSL runs for accounts, but check its log, and monitor the hostname certificate too.
10. A routine you can keep
Weekly: read the Security Advisor and update logs, check the mail queue and backup status, look at the firewall and cPHulk blocks. Monthly: apply operating system updates and reboot if needed, review accounts, resellers and API tokens, check PHP versions in use, scan accounts for malware. Quarterly: do a restore test, review firewall rules and listening services, check blocklists, and review who has access.
Write this down, with the date each item was last done. A checklist on paper is what turns good intentions into a server that stays healthy.
When it is worth getting help
If your server is already in use and nobody has reviewed it, a structured hardening pass with a before and after list is the fastest way to find the real gaps. If you run a hosting business, regular upkeep (patching, backups, abuse handling, migrations) is worth handing to someone who does it every week.
I work with cPanel/WHM, Plesk, DirectAdmin and CloudLinux servers. You can see my profile on Upwork, or read about hosting platform setup and server hardening.