WHM API.
https://api.docs.cpanel.net/_mock/specifications/whm.openapi/
https://{host}:{port}/json-api/
Request
This function retrieves the ModSecurity™ rules from one or more ModSecurity configuration files.
Important:
- When you disable the Web Server role, the system disables this function.
- You must include either the
vendor_idor theconfigparameters.
The file path to the configuration file, relative to the /usr/local/apache/conf directory.
Note:
You can use a comma-delimited list for multiple configuration files.
Whether to exclude comments that are not associated with any directives.
1— Exclude.0— Do not exclude.
Whether the function only returns the SecRule and SecAction directives from the configuration file, and comments that are not associated with a rule.
1— Only return theSecRuleandSecActiondirectives and comments not associated with a rule.0— Return all directives and comments.
- Mock server
https://api.docs.cpanel.net/_mock/specifications/whm.openapi/modsec_get_rules
- A server running WHM.
https://whm-server.tld:2087/json-api/modsec_get_rules
- 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_rules?config=string&exclude_bare_comments=1&exclude_other_directives=1&vendor_id=string'{ "data": { "chunks": [ … ], "staged_changes": 0 }, "metadata": { "command": "modsec_get_rules", "reason": "OK", "result": 1, "version": 1 } }
Request
This function removes a rule from a ModSecurity™ configuration 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_remove_rule
- A server running WHM.
https://whm-server.tld:2087/json-api/modsec_remove_rule
- 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_rule?config=modsec_vendor_configs%2Fexample.conf&id=1234567890'{ "data": {}, "metadata": { "command": "modsec_remove_rule", "reason": "OK", "result": 1, "version": 1 } }
Request
This function submits ModSecurity™ rule error reports to a remote receiver. The third party rule vendors use these error reports to identify problems with their rule sets.
Important:
When you disable the Web Server role, the system disables this function.
The contact email address to send with the error report. This allows the rule's vendor to reply to the user directly.
A short message that explains the reason for the report.
The MySQL® row IDs from the hits table in the modsec database for the audit log event to report.
Note:
If you specify more than one row ID:
- You must comma-separate the rule IDs.
- The rule IDs must all correspond to the same ModSecurity rule.
Whether the function sends the report to the rule's vendor.
1— Send the report.0— Do not send the report.
- Mock server
https://api.docs.cpanel.net/_mock/specifications/whm.openapi/modsec_report_rule
- A server running WHM.
https://whm-server.tld:2087/json-api/modsec_report_rule
- 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_report_rule?email=john.doe%40example.com&message=Hi.+We%27re+having+some+trouble+with+this+rule.+It+seems+to+be%0Ablocking+all+requests.&row_ids=0&send=1&type=false+positive'{ "data": { "report": [ … ] }, "metadata": { "command": "modsec_report_rule", "reason": "OK", "result": 1, "version": 1 } }