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:

setting_idDocumentation
0SecAuditEngine
1SecConnEngine
2SecRuleEngine
3SecDisableBackendCompression
4SecGeoLookupDb
5SecGsbLookupDb
6SecGuardianLog
7SecHttpBlKey
8SecPcreMatchLimit
9SecPcreMatchLimitRecursion
SecurityBasicAuth
Request
query Parameters
setting_id
required
integer [ 0 .. 9 ]

The configuration setting's ID.

Note:

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

Examples:
setting_id=setting_id1=1 setting_id2=2 setting_id3=3
setting_id=1
required
string or string or string or string or integer

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.
Examples:
state=state1=On state2=On state3=Off
state=On
remove
integer
Default: 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.

Enum: 1 0 Examples:
remove=remove1=0 remove2=1 remove3=0
remove=1
Responses
200

HTTP Request was successful.

Response Schema: application/json
object
object
get/modsec_batch_settings
Request samples
whmapi1 --output=jsonpretty \
  modsec_batch_settings \
  setting_id='1' \
  state='On'
Response samples
application/json
{
  • "data": {},
  • "metadata": {
    • "command": "modsec_batch_settings",
    • "reason": "OK",
    • "result": 1,
    • "version": 1
    }
}