WHM API.
https://api.docs.cpanel.net/_mock/specifications/whm.openapi/
https://{host}:{port}/json-api/
Request
This function deploys the staged changes to your modsec2.cpanel.conf file and attempts to restart Apache. If the new settings fail validation, the system restores the /etc/apache2/conf.d/modsec/modsec2.cpanel.conf file.
Note:
Call the WHM API 1 modsec_set_setting function to prepare your changes for the modsec2.cpanel.conf file.
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_settings_changes
- A server running WHM.
https://whm-server.tld:2087/json-api/modsec_deploy_settings_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_settings_changes{ "data": {}, "metadata": { "command": "modsec_deploy_settings_changes", "reason": "OK", "result": 1, "version": 1 } }
Request
This function retrieves a ModSecurity™ configuration file's contents.
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_get_config_text
- A server running WHM.
https://whm-server.tld:2087/json-api/modsec_get_config_text
- 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_get_config_text?config=modsec2.example.conf'{ "data": { "text": "SecRule REQUEST_URI \"example\" \"deny:id:123456789\" SecAction \"pass:auditlog:id:444444444\"" }, "metadata": { "command": "modsec_get_config_text", "reason": "OK", "result": 1, "version": 1 } }
Request
This function lists ModSecurity™ configuration files. The system stores the configuration files in the /usr/local/apache/conf/modsec_vendor_configs directory.
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_get_configs
- A server running WHM.
https://whm-server.tld:2087/json-api/modsec_get_configs
- 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_get_configs{ "data": { "configs": [ … ] }, "metadata": { "command": "modsec_get_configs", "reason": "OK", "result": 1, "version": 1 } }