Skip to main content

Create Custom Rule

Parameters

Description

Type

Required

organization_uuid

The created organization in Medianova Cloud Panel unit ID value.

String

Yes

resource_uuid

The created resource in Medianova Cloud Panel unit ID value. Path parameter.

String

Yes

type

When creating a WAF resource, "waf" is written in this field.

String

Yes

waf_status

This parameter takes the values ​​"detectiononly”, “on”, “off".

String

Yes

waf_rules

It is the parameter containing rule definitions.

Array

Yes

waf_rules.rule_name

A name is entered for the entered rule. waf_status is the required field when "on" or "detectiononly".

String

Yes

waf_rules.conditions

This parameter includes “field”, “operator”, “value” parameters.

Array

Yes

waf_rules.conditions.field

This parameter takes the values “user_agent”, “request_protocol”, “request_uri”, “args”, “referrer”, “client_ip”, “request_method”.

String

Yes

waf_rules.conditions.operator

This parameter takes “contain”, “not_contain”, “equal”, “not_equal” values ​​when the field parameter is user_agent, request_protocol, request_uri, args, referrer.
This parameter takes “equal”, “not_equal”, “within”, “not_within” values when the field parameter is request_method.
This parameter takes “match”, “not_match” values when the field parameter is client_ip.

String

Yes

waf_rules.conditions.value

The value to be mapped is entered in the rule.

String

Yes

waf_rules.rule_action

This parameter takes the values ​​"allow”, “block”.

String

Yes

Payload

CODE
{
    "resource_uuid": "***-****-*****-****",
    "waf_status": "detectiononly",
    "type": "waf",
    "waf_rules": [
        {
            "rule_name": "rule1",
            "conditions": [
                {
                    "field": "user_agent",
                    "operator": "contain",
                    "value": "test"
                }
            ],
            "rule_action": "block"
        },
        {
            "rule_name": "rule2",
            "conditions": [
                {
                    "field": "request_protocol",
                    "operator": "not_contain",
                    "value": "test"
                }
            ],
            "rule_action": "block"
        },
        {
            "rule_name": "rule3",
            "conditions": [
                {
                    "field": "request_uri",
                    "operator": "contain",
                    "value": "test"
                }
            ],
            "rule_action": "block"
        },
        {
            "rule_name": "rule4",
            "conditions": [
                {
                    "field": "args",
                    "operator": "equal",
                    "value": "test"
                }
            ],
            "rule_action": "block"
        },
        {
            "rule_name": "rule5",
            "conditions": [
                {
                    "field": "referrer",
                    "operator": "not_equal",
                    "value": "test"
                }
            ],
            "rule_action": "block"
        },
        {
            "rule_name": "rule6",
            "conditions": [
                {
                    "field": "client_ip",
                    "operator": "match",
                    "value": [
                        "1.1.1.1",
                        "2.2.2.2"
                    ]
                }
            ],
            "rule_action": "allow"
        },
        {
            "rule_name": "rule7",
            "conditions": [
                {
                    "field": "request_method",
                    "operator": "within",
                    "value": [
                        "GET",
                        "POST",
                        "PURGE",
                        "PUT",
                        "HEAD",
                        "OPTIONS",
                        "DELETE",
                        "PATCH"
                    ]
                }
            ],
            "rule_action": "allow"
        }
    ]
}

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.