Child pages
  • WHM API 1 Functions - modsec_discard_all_rule_changes

Versions Compared

Key

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

Description

Excerpt

This function discards the staged ModSecurity™ rule changes, if present, for all of the configuration files.

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_discard_all_rule_changes?api.version=1



Expand
titleXML API


Code Block
languagexml
https://hostname.example.com:2087/cpsess##########/xml-api/modsec_discard_all_rule_changes?api.version=1 



Expand
titleCommand Line


Code Block
languagebash
whmapi1 modsec_discard_all_rule_changes

Include Page
LIB:_WHMAPI1CLINote
LIB:_WHMAPI1CLINote


Expand
titleOutput (JSON)


Code Block
languagetext
linenumberstrue
 {
    "data": {
        "outcomes": [
            {
                "ok": 1,
                "config": "modsec2.user.conf"
            },
            {
                "ok": 1,
                "config": "modsec_vendor_configs/MyVendor/one.conf"
            }
        ]
    },
    "metadata": {
        "version": 1,
        "reason": "OK",
        "result": 1,
        "command": "modsec_discard_all_rule_changes"
    }
}



Expand
titleOutput (XML)


Code Block
languagetext
linenumberstrue
 <result>
    <data>
        <outcomes>
            <ok>1</ok>
            <config>modsec2.user.conf</config>
        </outcomes>
        <outcomes>
            <ok>1</ok>
            <config>modsec_vendor_configs/MyVendor/one.conf</config>
        </outcomes>
    </data>
    <metadata>
        <version>1</version>
        <reason>OK</reason>
        <result>1</result>
        <command>modsec_discard_all_rule_changes</command>
    </metadata>
</result>


Include Page
LIB:_WHMAPIShellNote
LIB:_WHMAPIShellNote


Parameters

This function does not accept parameters.

Returns

ReturnTypeDescriptionPossible valuesExample
outcomesarray of hashesAn array of hashes that contains information about the discarded configuration changes.Each hash includes the config, ok, and exception returns. 

config

string

The file path to the configuration file.

The function returns this value in the outcomes array.

  • EasyApache 3 — A valid path, relative to the/usr/local/apache/conf/ directory.  
  • EasyApache 4 and cPanel & WHM version 56 or earlier — A valid path, relative to the /etc/apache2/conf.d/ directory.
  • EasyApache 4 and cPanel & WHM version 58 or later — A valid path, relative to the /etc/apache2/conf.d/modsec/ directory.
modsec_vendor_configs/MyVendor/one.conf

ok

Boolean

Whether the system successfully discarded the rule change.

The function returns this value in the outcomes array.

  • 1 — Success.
  • 0 — Failure.
1

exception

string

The error message for a failed discard.

The function returns this value in the outcomes array.

Note
titleNote:

The function only returns this value if an error occurs.


The reason for failure.


Expand
titleClick to view...

The system could not remove the file “/usr/local/apache/conf/modsec_vendor_configs/MyVendor/one.conf.STAGE”: Invalid argument\n


failedarray

The list of configuration files that contain changes that the system could not discard.

Note
titleNote:

The function only returns this value if an error occurs.


A list of one or more configuration files. modsec_vendor_configs/MyVendor/one.conf