WHM API.
https://api.docs.cpanel.net/_mock/specifications/whm.openapi/
https://{host}:{port}/json-api/
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
- CLI
- URL
- curl
- JavaScript
- Node.js
- Python
- Java
- Java8+Apache
- C#
- C#+Newtonsoft
- PHP
- Go
- Ruby
- R
whmapi1 --output=jsonpretty \
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
- CLI
- URL
- curl
- JavaScript
- Node.js
- Python
- Java
- Java8+Apache
- C#
- C#+Newtonsoft
- PHP
- Go
- Ruby
- R
whmapi1 --output=jsonpretty \
modsec_set_config_text \
config='modsec2.example.conf' \
text='SecRule REQUEST_URI "example" "deny,id:123456789" SecAction "pass,auditlog,id"'{ "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
- CLI
- URL
- curl
- JavaScript
- Node.js
- Python
- Java
- Java8+Apache
- C#
- C#+Newtonsoft
- PHP
- Go
- Ruby
- R
whmapi1 --output=jsonpretty \
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 } }