Update ModSecurity configuration

This function sets a global ModSecurity™ configuration directive.

Important:

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

SecurityBasicAuth
Request
query Parameters
setting_id
required
integer >= 0

The setting's ID.

Note:

The WHM API 1 modsec_get_settings function returns this value.

Example: setting_id=8
state
required
string

The setting's new state. The function uses this as a valid argument for the directive.

Note:

For more information, read SpiderLabs' ModSecurity documentation.

Example: state=2000
Responses
200

HTTP Request was successful.

Response Schema: application/json
object
object
get/modsec_set_setting
Request samples
whmapi1 --output=jsonpretty \
  modsec_set_setting \
  setting_id='8' \
  state='2000'
Response samples
application/json
{
  • "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": [
      • {
        • "name": "Log all transactions.",
        • "option": "On"
        }
      ],
    • "setting_id": 8,
    • "state": 2000,
    • "type": "text",
    • "validation": [
      • {
        • "arg": "[Ee]xample",
        • "name": "startsWith"
        }
      ]
    },
  • "metadata": {
    • "command": "modsec_set_setting",
    • "reason": "OK",
    • "result": 1,
    • "version": 1
    }
}