WHM API.
https://api.docs.cpanel.net/_mock/specifications/whm.openapi/
https://{host}:{port}/json-api/
Request
This function retrieves the server's ModSecurity™ configuration settings. The system stores these settings in the /usr/local/apache/conf/modsec2.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_get_settings
- A server running WHM.
https://whm-server.tld:2087/json-api/modsec_get_settings
- 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_settings{ "data": { "settings": [ … ] }, "metadata": { "command": "modsec_get_settings", "reason": "OK", "result": 1, "version": 1 } }
Request
This function checks whether the ModSecurity™ module is installed.
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_is_installed
- A server running WHM.
https://whm-server.tld:2087/json-api/modsec_is_installed
- 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_is_installed{ "data": { "data": { … } }, "metadata": { "command": "modsec_is_installed", "reason": "OK", "result": 1, "version": 1 } }
Request
This function adds an include for a ModSecurity™ configuration file to the modsec2.cpanel.conf file. This makes the ModSecurity configuration file active.
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_active
- A server running WHM.
https://whm-server.tld:2087/json-api/modsec_make_config_active
- 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_active?config=modsec_vendor_configs%2Fexample.conf'{ "data": {}, "metadata": { "command": "modsec_make_config_active", "reason": "OK", "result": 1, "version": 1 } }