Restrict Access to WHM by CIDR list.

This function restricts root login to cPanel & WHM based on a list of CIDR addresses.

Note:

This API manipulates /var/cpanel/authorized_whm_root_ips. We HIGHLY recommend you not modify this file directly. Improper formatting of the file can lead to loss of all access to cPanel & WHM using the root password.

Use of this API replaces any previous restrictions so be sure to include previous CIDR patterns when adding new ones.

As this API only restricts logins, please be aware that existing root logins are not terminated when these restrictions are asserted.

This API DOES NOT restrict root resellers.

SecurityBasicAuth
Request
query Parameters
cidr
required
string <cidr>

The IPs you wish to restrict in CIDR format.

Note:

You can pass this parameter multiple times.

Examples:
cidr=10.2.0.0/16&cidr=10.6.5.0/24&cidr=10.1.6.7
cidr=10.2.0.0/16
Responses
200

HTTP Request was successful.

Response Schema: application/json
object
object
get/restrict_whm_root_access
Request samples
whmapi1 --output=jsonpretty \
  restrict_whm_root_access \
  cidr=10.2.0.0/16 \
  cidr=10.6.5.0/24 \
  cidr=10.1.6.7
Response samples
application/json
{
  • "data": {
    • "cidr": [
      • "10.2.0.0/16",
      • "10.6.5.0/24",
      • "10.1.6.7"
      ]
    },
  • "metadata": {
    • "command": "restrict_whm_root_access",
    • "reason": "OK",
    • "result": 1,
    • "version": 1
    }
}