Skip to content

Connect cPanel and WHM servers

ClientFence creates, suspends and removes cPanel accounts through the WHM API. You add each server once with an API token, then link your hosting plans to WHM packages.

  1. Sign in to WHM as root (or as the reseller that will own the accounts) and open Manage API Tokens in the Development section.
  2. Select Generate Token and enter a Name, such as clientfence.
  3. In IPs, enter the IP address of your ClientFence server, so only it can use the token.
  4. Under Privileges, keep the rights ClientFence needs: creating, suspending, removing and changing accounts, listing and creating packages, changing passwords, and Create User Session for the client’s one-click sign-in. Everything covers them all.
  5. Choose whether the token expires. When it expires, every action fails until you save a new one.
  6. Select Generate, copy the token, then select Yes, I saved my token. WHM never shows it again.

See cPanel’s guide Manage API Tokens in WHM.

  1. Go to System → Hosting Plans and Servers, stay on the Hosting Servers tab and select New Server.
  2. Fill in the form and select Add Server:
Field What to enter
Name Any name you know the server by.
Hostname The address WHM opens at, such as server1.example.com. ClientFence connects to it.
IP The server’s main IP address. New accounts show it until a sync reads their own IP.
Server Manager WHM (cPanel).
Username The WHM user that owns the token, usually root.
Access Hash or API Token The API token.
Connection Port Empty uses 2087, WHM’s HTTPS port.
Use Secure Connection Yes (HTTPS).
Verify TLS Certificate Yes, unless the server uses a self-signed certificate.
Password Length Length of the passwords ClientFence makes for new accounts. Empty means 10.
  1. Select Test Connection (the signal icon) on the server’s row. It asks WHM for its version.

Saved credentials are never shown again. To change one, enter a new value and save. The Users Prefix on the server’s edit page has no effect on cPanel accounts.

Make a hosting plan on the Hosting Plans tab (New Plan), then fill in its limits on the plan’s page. ClientFence uses a WHM package for it in one of two ways:

  • A package named for you. By default the package is <Username>_<plan name>, such as root_Basic. If it does not exist, ClientFence creates it with the plan’s limits when it first creates an account or changes a plan. Later changes to the plan’s limits do not change an existing package: edit it in WHM.
  • A package you made in WHM. On the plan’s page, under Hosting Plan Additional Parameters, add the Parameter Name package with the exact WHM package name as Parameter Value, then select Add New Field. ClientFence then uses that package as it is and never creates it.

Other parameters, used only when ClientFence creates the package: cgi, cpmod (the cPanel theme), maxlst (mailing lists) and hasshell. For reseller hosting, acl names the WHM reseller ACL list to give new resellers.

Then choose the server and the hosting plan in the product’s Configuration tab, under Hosting Settings. See Products.

Action What happens
Order activated Creates the account with a username from the domain (letters and digits, never starting with a digit or test), a new password and the client’s email as contact. With Reseller Hosting, also makes it a reseller.
Suspend / unsuspend Suspends or unsuspends the account.
Cancel Removes the account and its DNS zone from the server.
Change Hosting Plan Moves the account to the plan’s package (created first if needed).
Change Account Password Changes the cPanel password and the account’s database passwords. Clients can do this on their service page too.
Change Username / Change Domain Renames the account or changes its main domain.
Change IP Moves the site to the IP address you enter.
Sync with server Reads the account and stores its username and IP in ClientFence.
Login to Control Panel (client) Opens cPanel signed in, or WHM for a reseller. If WHM refuses, it opens https://<Hostname>/cpanel to sign in by hand.
Jump to control panel (staff) Opens https://<Hostname>/cpanel; Reseller control panel opens /whm.

A new password, username, domain or IP reaches WHM on active, suspended and expired orders. While an order is not yet set up or is canceled, the change is saved in ClientFence only.

  • The “cPanel WHM” server manager is not fully configured: fill in the Hostname, Username or token the message names.
  • Failed to … on the cPanel server, check the error logs: WHM refused the request. Its reason is in Activity → System Activity.
  • The package “…” was not found on the cPanel WHM server: the package parameter names a package WHM does not have. Fix the name or make the package.
  • The cPanel server returned HTTP status … (such as 401 or 403): check the Username, the token and the token’s IPs list in WHM.
  • Could not connect to the cPanel server: check the Hostname, the Connection Port and that the server’s firewall lets the ClientFence server reach it.

Failed order actions are listed under Orders → Failed actions. See Failed actions.