WHM API.
https://api.docs.cpanel.net/_mock/specifications/whm.openapi/
https://{host}:{port}/json-api/
Request
This function checks a ModSecurity™ rule's validity.
Important:
When you disable the Web Server role, the system disables this function.
- Mock server
https://api.docs.cpanel.net/_mock/specifications/whm.openapi/modsec_check_rule
- A server running WHM.
https://whm-server.tld:2087/json-api/modsec_check_rule
- curl
- JavaScript
- Node.js
- Python
- Java
- C#
- PHP
- Go
- Ruby
- R
- Payload
curl -i -X GET \
-u <username>:<password> \
'https://api.docs.cpanel.net/_mock/specifications/whm.openapi/modsec_check_rule?rule=SecAction+%22pass%2Cid%3A1234567%22'{ "data": { "problem": "The rule is invalid. Apache returned the following error: AH00526: Syntax error on line 1 of /var/tmp/15500._USR_LOCAL_CPANEL_WHOSTMGR_BIN_XML_API__.gl2t8wZ1.tmp/validate.conf:\nInvalid command ''OWASP'', perhaps misspelled or defined by a module not included in the server configuration\n'", "valid": 0 }, "metadata": { "command": "modsec_check_rule", "reason": "OK Invalid Rule", "result": 1, "version": 1 } }
Request
This function copies a ModSecurity™ rule with a new rule ID.
Important:
When you disable the Web Server role, the system disables this function.
- Mock server
https://api.docs.cpanel.net/_mock/specifications/whm.openapi/modsec_clone_rule
- A server running WHM.
https://whm-server.tld:2087/json-api/modsec_clone_rule
- curl
- JavaScript
- Node.js
- Python
- Java
- C#
- PHP
- Go
- Ruby
- R
- Payload
curl -i -X GET \
-u <username>:<password> \
'https://api.docs.cpanel.net/_mock/specifications/whm.openapi/modsec_clone_rule?config=modsec2.user.conf&id=123456789'{ "data": { "rule": { … } }, "metadata": { "command": "modsec_clone_rule", "reason": "OK", "result": 1, "version": 1 } }
Request
This function deploys the staged changes for all of the ModSecurity™ configuration files into the live configuration files. After the function deploys the configuration files, it restarts Apache. If the new configuration is invalid, the system restores the original configuration and preserves the staged changes.
Important:
When you disable the Web Server role, the system disables this function.
- Mock server
https://api.docs.cpanel.net/_mock/specifications/whm.openapi/modsec_deploy_all_rule_changes
- A server running WHM.
https://whm-server.tld:2087/json-api/modsec_deploy_all_rule_changes
- curl
- JavaScript
- Node.js
- Python
- Java
- C#
- PHP
- Go
- Ruby
- R
- Payload
curl -i -X GET \
-u <username>:<password> \
https://api.docs.cpanel.net/_mock/specifications/whm.openapi/modsec_deploy_all_rule_changes{ "data": { "failed": [ … ], "outcomes": [ … ] }, "metadata": { "command": "modsec_deploy_all_rule_changes", "reason": "OK", "result": 1, "version": 1 } }