Update staged ModSecurity rule

This function stages edits to a ModSecurity™ rule. The system does not save changes directly to the configuration file. Instead, it stages the changes to the configuration file's .STAGE file (for example, for the example.conf file, the system stages changes in the example.conf.STAGE file).

Important:

When you disable the Web Server role, the system disables this function.

SecurityBasicAuth
Request
query Parameters
config
required
string

The ModSecurity configuration file, relative to the /usr/local/apache/conf/ directory.

Example: config=modsec_vendor_configs/example.conf
id
required
integer

The ModSecurity rule's ID.

Example: id=1234567
rule
required
string

The new ModSecurity rule.

Example: rule=SecAction "pass,id:1234567"
Responses
200

HTTP Request was successful.

Response Schema: application/json
object
object
get/modsec_edit_rule
Request samples
whmapi1 --output=jsonpretty \
  modsec_edit_rule \
  config='modsec_vendor_configs/example.conf' \
  id='1234567' \
  rule='SecAction "pass,id:1234567"'
Response samples
application/json
{
  • "data": {
    • "rule": {
      • "disabled": 0,
      • "id": 1234567,
      • "meta_msg": "",
      • "rule": "SecAction \"pass,id:1234567\""
      }
    },
  • "metadata": {
    • "command": "modsec_edit_rule",
    • "reason": "OK",
    • "result": 1,
    • "version": 1
    }
}