Child pages
  • WHM API 1 Functions - modsec_set_setting

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Description

Excerpt

This function sets a global ModSecurity™ configuration directive.

Multiexcerpt include
SpaceWithExcerptcom.atlassian.confluence.content.render.xhtml.model.resource.identifiers.SpaceResourceIdentifier@12665
MultiExcerptNameAPIDisabledWebServerRole
PageWithExcerptLIB:_ServerRoleDisabledAPI

Panel
bgColor#F2F2F2
borderStylenone

Examples


Panel
bgColor#FFFFFF
borderStylenone


Expand
titleJSON API


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



Expand
titleXML API


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



Expand
titleCommand Line


Code Block
languagebash
whmapi1 modsec_set_setting setting_id=8 state=2000 

Include Page
LIB:_WHMAPI1CLINote
LIB:_WHMAPI1CLINote


Expand
titleOutput (JSON)


Code Block
languagetext
linenumberstrue
{
    "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"
    }
}



Expand
titleOutput (XML)


Code Block
languagetext
linenumberstrue
<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>


Include Page
LIB:_WHMAPIShellNote
LIB:_WHMAPIShellNote


Parameters

ParameterTypeDescriptionPossible valuesExample
setting_idinteger

Required

The setting's ID.

 

A non-negative integer.

Note
titleNote:

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.

Note
titleNote:

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.

 


Expand
titleClick to view...
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.

Note
titleNote:

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.

    Note
    titleNote:

    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.


Expand
titleClick to view...
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.

 

Anchor
Radio
Radio
Radio options

Expand
titleClick to view...

Include Page
LIB:_Modsec_radio_options
LIB:_Modsec_radio_options

Anchor
Validators
Validators
Validators

Expand
titleClick to view...

Include Page
LIB:_Modsec_Validators
LIB:_Modsec_Validators