latestOpenAPI 3.0.2cPanel License2026-08-106251554.3 MB

3da41671c02c

ModSecurity
Server Settings

Run ModSecurity batch settings

This function adds, updates, and removes global ModSecurity™ configuration directives. The function modifies these directives in the /usr/local/apache/conf/modsec2.cpanel.conf file.

Important:

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

This function only supports the following ModSecurity™ configuration directives:

<table> <tr><th>setting_id</th><th>Documentation</th></tr> <tr><td>0</td><td><a href="https://github.com/SpiderLabs/ModSecurity/wiki/Reference-Manual-%28v2.x%29#secauditengine">SecAuditEngine</a></td></tr> <tr><td>1</td><td><a href="https://github.com/SpiderLabs/ModSecurity/wiki/Reference-Manual-%28v2.x%29#secconnengine">SecConnEngine</a></td></tr> <tr><td>2</td><td><a href="https://github.com/SpiderLabs/ModSecurity/wiki/Reference-Manual-%28v2.x%29#secruleengine">SecRuleEngine</a></td></tr> <tr><td>3</td><td><a href="https://github.com/SpiderLabs/ModSecurity/wiki/Reference-Manual-%28v2.x%29#secdisablebackendcompression">SecDisableBackendCompression</a></td></tr> <tr><td>4</td><td><a href="https://github.com/SpiderLabs/ModSecurity/wiki/Reference-Manual-%28v2.x%29#secgeolookupdb">SecGeoLookupDb</a></td></tr> <tr><td>5</td><td><a href="https://github.com/SpiderLabs/ModSecurity/wiki/Reference-Manual-%28v2.x%29#secgsblookupdb">SecGsbLookupDb</a></td></tr> <tr><td>6</td><td><a href="https://github.com/SpiderLabs/ModSecurity/wiki/Reference-Manual-%28v2.x%29#secguardianlog">SecGuardianLog</a></td></tr> <tr><td>7</td><td><a href="https://github.com/SpiderLabs/ModSecurity/wiki/Reference-Manual-%28v2.x%29#sechttpblkey">SecHttpBlKey</a></td></tr> <tr><td>8</td><td><a href="https://github.com/SpiderLabs/ModSecurity/wiki/Reference-Manual-%28v2.x%29#secpcrematchlimit">SecPcreMatchLimit</a></td></tr> <tr><td>9</td><td><a href="https://github.com/SpiderLabs/ModSecurity/wiki/Reference-Manual-%28v2.x%29#secpcrematchlimitrecursion">SecPcreMatchLimitRecursion</a></td></tr> </table>
get/modsec_batch_settings

Query parameters

setting_idinteger required

The configuration setting's ID.

Note:

To configure multiple IDs, increment the parameter name. For example, setting_id1, setting_id2, and setting_id3.

'On' | 'Off' required
OR
'On' | 'Off' | 'DetectionOnly' required
OR
'On' | 'Off' | 'RelevantOnly' required
OR
string required
OR
integer required

The configuration setting's current state.

  • On
  • Off

Some settings accept additional values for this parameter. See the references above for more inforamation.

Note:

  • To configure multiple settings, increment the parameter name. For example, state1, state2, and state3.
  • state is ignored if remove is set to 1 for the setting.
remove1 | 0

Whether to add or remove the configuration setting in the /usr/local/apache/conf/modsec2.cpanel.conf file.

  • 1 — Remove the configuration setting.

  • 0 — Add or update the configuration setting.

  • To remove multiple settings, increment the parameter name. For example, remove1, remove2, and remove3.

Response

HTTP Request was successful.

Example response

{
  "data": {
    "updated_settings": [
      {
        "default": 1500,
        "description": "define the match limit of the PCRE library.",
        "directive": "SecAuditEngine",
        "engine": 1,
        "name": "Audit Log Level",
        "radio_options": [
          {
            "name": "Log all transactions.",
            "option": "On"
          }
        ],
        "setting_id": 1,
        "state": "On",
        "type": "radio",
        "url": "https://github.com/SpiderLabs/ModSecurity/wiki/Reference-Manual#secpcrematchlimit"
      }
    ]
  },
  "metadata": {
    "command": "modsec_batch_settings",
    "reason": "OK",
    "result": 1,
    "version": 1
  }
}