Description

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

Examples 




https://hostname.example.com:2087/cpsess##########/json-api/modsec_discard_all_rule_changes?api.version=1




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




whmapi1 modsec_discard_all_rule_changes



 {
    "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"
    }
}




 <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>



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.

The function only returns this value if an error occurs.


The reason for failure.


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.

The function only returns this value if an error occurs.


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