WHM API.
https://api.docs.cpanel.net/_mock/specifications/whm.openapi/
https://{host}:{port}/json-api/
Request
This function deploys staged changes to the ModSecurity™ configuration file and restarts Apache.
Note:
If the new configuration is invalid, the system will restore the original configuration and maintain 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_rule_changes
- A server running WHM.
https://whm-server.tld:2087/json-api/modsec_deploy_rule_changes
- CLI
- URL
- curl
- JavaScript
- Node.js
- Python
- Java
- Java8+Apache
- C#
- C#+Newtonsoft
- PHP
- Go
- Ruby
- R
whmapi1 --output=jsonpretty \
modsec_deploy_rule_changes \
config='modsec_vendor_configs/example.conf'{ "data": {}, "metadata": { "command": "modsec_deploy_rule_changes", "reason": "OK", "result": 1, "version": 1 } }
Request
This function disables a ModSecurity™ rule.
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_disable_rule
- A server running WHM.
https://whm-server.tld:2087/json-api/modsec_disable_rule
- CLI
- URL
- curl
- JavaScript
- Node.js
- Python
- Java
- Java8+Apache
- C#
- C#+Newtonsoft
- PHP
- Go
- Ruby
- R
whmapi1 --output=jsonpretty \
modsec_disable_rule \
config='modsec_vendor_configs/example.conf' \
id='1234567890'{ "metadata": { "command": "modsec_disable_rule", "reason": "OK", "result": 1, "version": 1 } }
Request
This function discards the staged ModSecurity™ rule changes, if present, for all of the configuration files.
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_discard_all_rule_changes
- A server running WHM.
https://whm-server.tld:2087/json-api/modsec_discard_all_rule_changes
- CLI
- URL
- curl
- JavaScript
- Node.js
- Python
- Java
- Java8+Apache
- C#
- C#+Newtonsoft
- PHP
- Go
- Ruby
- R
whmapi1 --output=jsonpretty \
modsec_discard_all_rule_changes{ "data": { "failed": [ … ], "outcomes": [ … ] }, "metadata": { "command": "modsec_discard_all_rule_changes", "reason": "OK", "result": 1, "version": 1 } }