cPanel/ModSecurity
cPanel module

ModSecurity

6 functions, invoked through the cpanel_uapi tool.

scope cpanel:uapi
Call any function with cpanel_uapi(service_id, module="ModSecurity", function, params). Live availability depends on the cPanel features JetHost has enabled on your account — call list_cpanel_operations to see what is active.

disable_all_domains GET#

Disable ModSecurity for all domains

This function disables ModSecurity™ on a cPanel account's domains.

Important:

When you disable the WebServer role, the system disables this function.

No parameters.

Response — normalized as { ok, data, errors[], warnings[] }; data is an array of:

dependenciesarray<string>
An array of domains that your changes to a selected domain affect.
domainstring
The cPanel account's domain.
enabledinteger
Whether ModSecurity is enabled on the account. 1 - Enabled. 0 - Disabled.
One of: 0 1
exceptionstring
An exception error message. The function only returns this value if an error occurs.
searchhintstring
A comma-separated list of domain-related search terms.
typestring
The domain type. main - A main domain. sub - A subdomain.
One of: main sub

disable_domains GET#

Disable ModSecurity for selected domains

This function disables ModSecurity™ on specified domains.

Important:

When you disable the WebServer role, the system disables this function.

domainsstringRequired
A comma-separated list of domains that the cPanel account owns. Important: The authenticated cPanel account must own these domains.

Response — normalized as { ok, data, errors[], warnings[] }; data contains:

Payload varies by call.

enable_all_domains GET#

Enable ModSecurity for all domains

This function enables ModSecurity™ on a cPanel account's domains.

Important:

When you disable the WebServer role, the system disables this function

No parameters.

Response — normalized as { ok, data, errors[], warnings[] }; data is an array of:

dependenciesarray<string>
An array of domains that your changes to a selected domain affect.
domainstring
The cPanel account's domain.
enabledinteger
Whether ModSecurity is enabled on the account. 1 - Enabled. 0 - Disabled.
One of: 0 1
exceptionstring
An exception error message. The function only returns this value if an error occurs.
searchhintstring
A comma-separated list of domain-related search terms.
typestring
The domain type. main - A main domain. sub - A subdomain.
One of: main sub

enable_domains GET#

Enable ModSecurity for selected domains

This function enables ModSecurity™ for specified domains.

Important:

When you disable the WebServer role, the system disables this function.

domainsstringRequired
A comma-separated list of domains for which to enable ModSecurity. Important: The authenticated cPanel account must own these domains.

Response — normalized as { ok, data, errors[], warnings[] }; data contains:

Payload varies by call.

has_modsecurity_installed GET#

Return ModSecurity installation status

This function checks whether ModSecurity™ is installed on a server.

Important:

When you disable the Web Server role, the system disables this function.

No parameters.

Response — normalized as { ok, data, errors[], warnings[] }; data contains:

installedinteger
Whether ModSecurity is installed on the server. 1 - Installed. 0 - Not installed.
One of: 0 1

list_domains GET#

Return ModSecurity domains' status

This function returns ModSecurity's™ status for a cPanel account's domains.

Important:

When you disable the WebServer role, the system disables this function.

No parameters.

Response — normalized as { ok, data, errors[], warnings[] }; data is an array of:

dependenciesarray<string>
An array of domains that your changes to a selected domain affect.
domainstring
The cPanel account's domain.
enabledinteger
Whether ModSecurity is enabled for the account. 1 - Enabled. 0 - Disabled.
One of: 0 1
searchhintstring
A comma-separated list of domain-related search terms.
typestring
The domain type. main - A main domain. sub - A subdomain.
One of: main sub