WHM API.
https://api.docs.cpanel.net/_mock/specifications/whm.openapi/
https://{host}:{port}/json-api/
Request
This function removes an include for a ModSecurity™ configuration file from the modsec2.cpanel.conf file. This makes the ModSecurity configuration file inactive.
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_make_config_inactive
- A server running WHM.
https://whm-server.tld:2087/json-api/modsec_make_config_inactive
- 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_make_config_inactive?config=modsec_vendor_configs%2Fexample.conf'{ "data": {}, "metadata": { "command": "modsec_make_config_inactive", "reason": "OK", "result": 1, "version": 1 } }
Request
This function removes a global ModSecurity™ configuration directive.
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_remove_setting
- A server running WHM.
https://whm-server.tld:2087/json-api/modsec_remove_setting
- 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_remove_setting?setting_id=3'{ "data": {}, "metadata": { "command": "modsec_remove_setting", "reason": "OK", "result": 1, "version": 1 } }
Request
This function sets the contents of a specified ModSecurity™ configuration file. The system stages any changes to the configuration file. To deploy the changes, call WHM API 1's modsec_deploy_rule_changes function.
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_set_config_text
- A server running WHM.
https://whm-server.tld:2087/json-api/modsec_set_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_set_config_text?config=modsec2.example.conf&text=SecRule+REQUEST_URI+%22example%22+%22deny%2Cid%3A123456789%22+SecAction+%22pass%2Cauditlog%2Cid%22'{ "data": null, "metadata": { "command": "modsec_set_config_text", "reason": "OK", "result": 1, "version": 1 } }