Description

This function sets a global ModSecurity™ configuration directive.

Examples




https://hostname.example.com:2087/cpsess##########/json-api/modsec_set_setting?api.version=1&setting_id=8&state=2000 




https://hostname.example.com:2087/cpsess##########/xml-api/modsec_set_setting?api.version=1&setting_id=8&state=2000 




whmapi1 modsec_set_setting setting_id=8 state=2000 



{
    "data": {
        "setting_id": 8,
        "name": "Perl Compatible Regular Expressions Library Match Limit",
        "default": 1500,
        "validation": [
            "positiveInteger"
        ],
        "description": "Define the match limit of the Perl Compatible Regular Expressions library.",
        "state": "2000",
        "url": "https://github.com/SpiderLabs/ModSecurity/wiki/Reference-Manual#secpcrematchlimit",
        "directive": "SecPcreMatchLimit",
        "type": "number"
    },
    "metadata": {
        "version": 1,
        "reason": "OK",
        "result": 1,
        "command": "modsec_set_setting"
    }
}




<result>
  <data>
    <name>Perl Compatible Regular Expressions Library Match Limit</name>
    <default>1500</default>
    <description>Define the match limit of the Perl Compatible Regular Expressions library.</description>
    <directive>SecPcreMatchLimit</directive>
    <setting_id>8</setting_id>
    <state>2000</state>
    <type>number</type>
    <url>https://github.com/SpiderLabs/ModSecurity/wiki/Reference-Manual#secpcrematchlimit</url>
    <validation>positiveInteger</validation>
  </data>
  <metadata>
    <command>modsec_set_setting</command>
    <reason>OK</reason>
    <result>1</result>
    <version>1</version>
  </metadata>
</result>



Parameters

ParameterTypeDescriptionPossible valuesExample
setting_idinteger

Required

The setting's ID.

 

A non-negative integer.

The WHM API 1 modsec_get_settings function returns this value.


8
statestring

Required

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

A valid string.

For more information, read our ModSecurity documentation.


2000

Returns

ReturnTypeDescriptionPossible valuesExample
default
string

The setting's default value.

A valid string
1500
description
stringThe setting's description.

A valid string.

 


This setting allows you to define the match limit of the PCRE library.


directive
stringThe setting's Apache directive.A valid directive name.
SecPcreMatchLimit
name
stringThe setting's name.A valid string.
PCRE library match limit
radio_options
array of hashes

An array of hashes of the options that the client should display, as buttons, for this setting in a user interface.

The function only returns this array of hashes when you set the type parameter's value to radio.


Read the Radio options section below for a list of possible values.

 
setting_id
integer

The setting's ID.

A valid non-negative integer.
8
state
integerThe setting's new state.The argument to the directive.
2000
typestringThe type of UI control that the client should use to represent the setting.
  • text — WHM users modify this setting via a text box.
  • radio — WHM users modify this setting via a radio button.

    If the type parameter's value is radio, the function also returns the radio_options array of hashes. 


  • number — WHM users modify this setting via a text box that only allows numeric values.
text
url
stringThe URL for the setting's documentation.A valid URL.


https://github.com/SpiderLabs/ModSecurity/wiki/Reference-Manual#secpcrematchlimit


validationarray

An array of validators to apply.

Read the Validators section below for a list of possible values.

 

Radio options

Validators