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
- CLI
- URL
- curl
- JavaScript
- Node.js
- Python
- Java
- Java8+Apache
- C#
- C#+Newtonsoft
- PHP
- Go
- Ruby
- R
whmapi1 --output=jsonpretty \
modsec_make_config_inactive \
config='modsec_vendor_configs/example.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
- 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 } }