Child pages
  • WHM API 1 Functions - modsec_update_vendor
Skip to end of metadata
Go to start of metadata

Description

This function updates a vendor with the current version of the rule set.

Important:

In cPanel & WHM version 76 and later, when you disable the WebServer role, the system disables this function. For more information, read our How to Use Server Profiles documentation.

Examples


 JSON API
https://hostname.example.com:2087/cpsess##########/json-api/modsec_update_vendor?api.version=1&url=http%3A%2F%2Fexample.com%2Fupdate%2Fmeta_MyVendor.yaml
 XML API
https://hostname.example.com:2087/cpsess##########/xml-api/modsec_update_vendor?api.version=1&url=http%3A%2F%2Fexample.com%2Fupdate%2Fmeta_MyVendor.yaml
 Command Line
whmapi1 modsec_update_vendor url=http%3A%2F%2Fexample.com%2Fupdate%2Fmeta_MyVendor.yaml%20


Notes:

  • You must URI-encode values.
  • For more information and additional output options, read our Guide to WHM API 1 documentation or run the whmapi1 --help command.
  • If you run CloudLinux™, you must use the full path of the whmapi1 command:

    /usr/local/cpanel/bin/whmapi1

 Output (JSON)
{
    "data": {
        "diagnostics": {
            "deleted_configs": [
                "modsec_vendor_configs/MyVendor/one.conf"
            ],
            "new_configs": [
                {
                    "vendor_id": "MyVendor",
                    "active": 0,
                    "config": "modsec_vendor_configs/MyVendor/two.conf"
                },
                {
                    "vendor_id": "MyVendor",
                    "active": 1,
                    "config": "modsec_vendor_configs/MyVendor/three.conf"
                }
            ],
            "added_configs": [
                "modsec_vendor_configs/MyVendor/three.conf"
            ],
            "prev_configs": [
                {
                    "config": "modsec_vendor_configs/MyVendor/one.conf"
                },
                {
                    "config": "modsec_vendor_configs/MyVendor/two.conf"
                }
            ]
        },
        "vendor": {
            "locked": 0,
            "vendor_url": "http://www.example.com/",
            "inst_dist": "MyVendor-2",
            "vendor_id": "MyVendor",
			"installed": 1
			"cpanel_provided": 0
            "name": "My Vendor",
            "path": "/usr/local/apache/conf/modsec_vendor_configs/MyVendor",
            "installed_from": "http://example.com/update/meta_MyVendor.yaml",
            "description": "This is an example of a custom vendor set (updated)",
            "archive_url": "http://example.com/update/MyVendor.zip",
            "dist_md5": "ecafce1bf148532250a8d4743a8374d1",
            "enabled": 1
        }
    },
    "metadata": {
        "version": 1,
        "reason": "OK",
        "result": 1,
        "command": "modsec_update_vendor"
    }
}
 Output (XML)
 <result>
    <data>
        <diagnostics>
            <deleted_configs>modsec_vendor_configs/MyVendor/one.conf</deleted_configs>
            <new_configs>
                <vendor_id>MyVendor</vendor_id>
                <active>0</active>
                <config>modsec_vendor_configs/MyVendor/two.conf</config>
            </new_configs>
            <new_configs>
                <vendor_id>MyVendor</vendor_id>
                <active>1</active>
                <config>modsec_vendor_configs/MyVendor/three.conf</config>
            </new_configs>
            <added_configs>modsec_vendor_configs/MyVendor/three.conf</added_configs>
            <prev_configs>
                <config>modsec_vendor_configs/MyVendor/one.conf</config>
            </prev_configs>
            <prev_configs>
                <config>modsec_vendor_configs/MyVendor/two.conf</config>
            </prev_configs>
        </diagnostics>
        <vendor>
			<archive_url>http://example.com/update/MyVendor.zip</archive_url>
			<cpanel_provided>0</cpanel_provided>
			<description>This is an example of a custom vendor set (updated)</description>
			<dist_md5>ecafce1bf148532250a8d4743a8374d1</dist_md5>
			<enabled>1</enabled>
			<inst_dist>MyVendor-2</inst_dist>
			<installed>1</installed>
			<installed_from>http://example.com/update/meta_MyVendor.yaml</installed_from>
			<name>My Vendor</name>
			<path>/usr/local/apache/conf/modsec_vendor_configs/MyVendor</path>
			<vendor_id>MyVendor</vendor_id>
			<vendor_url>http://www.example.com</vendor_url>
        </vendor>
    </data>
    <metadata>
        <version>1</version>
        <reason>OK</reason>
        <result>1</result>
        <command>modsec_update_vendor</command>
    </metadata>
</result>


Note:

Use WHM's API Shell interface (WHM >> Home >> Development >> API Shell) to directly test WHM API calls.

Parameters

Parameter

Type

Description

Possible values

Example

url

string

Required

The vendor metadata file's URL.

A valid URL.

http://example.com/update/meta_MyVendor.yaml

Returns

Return

Type

Description

Possible values

Example

vendor

hash

A hash of updated vendor information.

This hash includes the locked, vendor_url, inst_dist, vendor_id, name, path, installed_from, description, archive_url, dist_md5, and enabled returns.

 

installed

Boolean

Whether the vendor is installed.

The function returns this value in the vendor hash.

  • 1 — Installed.

  • 0Not installed.

1

vendor_url

string

The URL to the vendor's website.

The function returns this value in the vendor hash.

A valid URL.

http://example.com/

inst_dist

string

The unique identifier for the rule set version.

The function returns this parameter in the   vendor   hash.

A valid string.

MyVendor-2

vendor_id

string

The vendor's unique short name.

The function returns this parameter in the vendor hash.

A valid string.

MyVendor

name

string

The vendor's name.

The function returns this parameter in the vendor hash.

A valid string.

My Vendor

path

string

The file path to the vendor's ModSecurity configuration files.

The function returns this value in the vendor hash.

An absolute file path.

 Click to view...

/usr/local/apache/conf/modsec_vendor_configs/MyVendor

installed_from

string

The URL to the vendor's metadata file.

The function returns this value in the vendor hash.

A valid URL.

 Click to view...

http://example.com/update/meta_MyVendor.yaml

description

string

The vendor's description.

The function returns this value in the vendor hash.

A valid string.

 Click to view...

This is an example of a custom vendor set (updated).

archive_url

string

The URL to download the vendor rules.

The function returns this value in the vendor hash.

A valid URL.

 Click to view...

http://example.com/update/MyVendor.zip

dist_md5

string

The download's MD5 checksum value.

The function returns this value in the vendor hash.

A valid checksum.

ecafce1bf148532250a8d4743a8374d1

enabled

Boolean

Whether the vendor is enabled.

The function returns this value in the vendor hash.

  • 1 — Enabled.

  • 0 — Disabled.

1

diagnostics

hash

A hash of diagnostic information about the update.

This hash includes the added_configs, deleted_configs, new_configs, and prev_configs arrays.

 

added_configs

array

A list of configuration files that the update added.

The function returns this array in the   diagnostics hash.

A list of added ModSecurity configuration files.

 Click to view...

modsec_vendor_configs/MyVendor/three.conf

deleted_configs

array

A list of configuration files that the update removed.

The function returns this array in the   diagnostics hash.

An array of deleted ModSecurity configuration files.

 Click to view...

modsec_vendor_configs/MyVendor/one.conf

new_configs

array of hashes

A complete list of configuration files that the update modified.

The function returns this array in the   diagnostics hash.

Each hash includes the active, config, and vendor_id returns.

 

active

Boolean

Whether the configuration file is active.

The function returns this value in the new_configs array.

  • 1 — Active.

  • 0Not active.

0

config

string

The file path to the configuration file.

The function returns this value in the new_configs array.

A path to the configuration file, relative to the /usr/local/apache/conf/ Apache configuration directory.

 Click to view...

 modsec_vendor_configs/MyVendor/two.conf

vendor_id

string

The vendor's unique name.

The function returns this value in the new_configs array.

A valid string.

MyVendor

prev_configs

array of hashes

A complete list of configuration files in the old version.

The function returns this array in the   diagnostics hash.

Each hash includes the config return.

 

config

string

The file path of the configuration file.

The function returns this value in the prev _configs array.

A path to the configuration file, relative to the /usr/local/apache/conf/ Apache configuration directory.

 Click to view...

modsec_vendor_configs/MyVendor/two.conf