WHM API.
https://api.docs.cpanel.net/_mock/specifications/whm.openapi/
https://{host}:{port}/json-api/
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 } }
Request
This function sets a global ModSecurity™ configuration directive.
Important:
When you disable the Web Server role, the system disables this function.
The setting's ID.
Note:
The WHM API 1 modsec_get_settings function returns this value.
The setting's new state. The function uses this as a valid argument for the directive.
Note:
For more information, read SpiderLabs' ModSecurity documentation.
- Mock server
https://api.docs.cpanel.net/_mock/specifications/whm.openapi/modsec_set_setting
- A server running WHM.
https://whm-server.tld:2087/json-api/modsec_set_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_set_setting?setting_id=8&state=2000'{ "data": { "default": "1500", "description": "This setting allows you to define the match limit of the PCRE library.", "directive": "SecPcreMatchLimit", "name": "PCRE library match limit", "radio_options": [ … ], "setting_id": 8, "state": 2000, "type": "text", "url": "https://github.com/SpiderLabs/ModSecurity/wiki/Reference-Manual#secpcrematchlimit", "validation": [ … ] }, "metadata": { "command": "modsec_set_setting", "reason": "OK", "result": 1, "version": 1 } }