You need to enable JavaScript to run this app.
导航

UpdateCCRule-更新 CC 防护规则

最近更新时间2024.03.01 16:47:38

首次发布时间2023.11.10 18:24:47

编辑 CC 防护规则,包括规则名称、请求特征和统计条件等信息。

请求说明

  • 请求方式:POST
  • 请求地址:https://open.volcengineapi.com/?Action=UpdateCCRule&Version=2020-12-09

请求参数

参数

类型

是否必填

示例值

描述

Name

String

123

CC 规则名称,支持英文、汉字和数字,不支持特殊字符。长度限制在 20 个字符内。

Url

String

/test/*

请求路径,支持通配符**仅可出现一次。

AdvancedEnable

Boolean

true

是否启用高级条件。

  • true:启用
  • false:不启用

Field

String

CLIENTIP

统计对象,多个对象用逗号分隔。格式为类型:对应值

  • 自定义 Header。格式为HEADER:具体参数,例如HEADER:Authorization
  • 自定义 Cookie。格式为COOKIE:具体参数,例如COOKIE:PHPSESSId
  • 自定义参数。格式为ARGS:具体参数,例如ARGS:device_Id
  • 源 IP。直接配置为CLIENTIP

SingleThreshold

Integer

10

每个统计对象访问的次数阈值。

PathThreshold

Integer

100

请求路径访问的次数阈值。

CountTime

Integer

60

统计时长,单位:秒。

CCType

Integer

0

执行动作。

  • 0:告警
  • 1::限速
  • 2::拦截
  • 7:人机验证

EffectTime

Integer

100

统计时长,单位:秒。
执行动作为“观察”时无需填写。

RulePriority

Integer

0

规则执行优先级,数字越大优先级越低。

  • 0:P0
  • 1:P1
  • 2:P2
  • 3:P3
  • 4:P4
  • 5:P5
  • 6:P6
  • 7:P7
  • 8:P8
  • 9:P9

Enable

Enum

1

是否启用规则。

  • 0:不启用
  • 1:启用

AccurateGroup

AccurateGroup object

-

高级条件配置,未开启高级条件时无需配置此字段。

Id

Integer

144565

规则对应的 ID。取控制台上“规则 ID“的后 6 位。

Host

String

example.volcwaf001.com

需要设置防护规则的网站域名。

AccurateGroup

参数

类型

是否必填

示例值

描述

AccurateRules

Array of AccurateRules objects

-

高级条件详情。

Logic

Integer

1

规则间的运算关系。

  • 1:与
  • 2:或

AccurateRules

参数

类型

是否必填

示例值

描述

HttpObj

String

request.method

自定义对象,与ObjType存在映射关系。

  • 请求协议:request.schema
  • 请求 uri:request.uri
  • 请求方法:request.method
  • 请求路径:request.path
  • 请求参数:request.queryargs
  • 请求头:request.header
  • 请求 User-Agent:request.header.ua
  • 请求 refer:request.header.refer
  • 请求 Cookies:request.header.cookies
  • 请求体长度:request.header.content-length
  • 请求体格式:request.header.content-type
  • X-forwarded-for:request.header.x-forwarded-for
  • 客户端 IP:request.header.clientip
  • 自定义 Args:request.queryargs.自定义参数名称。例如request.queryargs.abc
  • 自定义 header:request.header.自定义Header 名称。例如request.header.abc
  • 自定义 cookie:request.cookie.自定义 cookie 名称。例如request.cookie.abc

ObjType

Integer

0

匹配字段。

  • 0:请求协议
  • 1:请求 uri
  • 2:请求方法
  • 3:请求路径
  • 4:请求参数
  • 5:请求头
  • 6:请求 User-Agent
  • 7:请求 refer
  • 8:请求 Cookies
  • 9:请求体长度
  • 10:请求体格式
  • 11:X-forwarded-for
  • 12:客户端 IP
  • 13:自定义 Args
  • 14:自定义 header
  • 15:自定义 cookie

Opretar

Integer

0

逻辑运算符。

  • 0:大于
  • 1:大于等于
  • 2:等于
  • 3:小于
  • 4:小于等于
  • 5:不等于
  • 6:包含子串
  • 7:不包含子串
  • 8:包含前缀
  • 9:不包含前缀
  • 10:包含后缀
  • 11:不包含后缀
  • 12:包含所有匹配集合
  • 13:不包含所有匹配集合
  • 14:属于匹配集合
  • 15:不属于匹配集合
  • 16:正则
  • 17:判断为 IP
  • 18:判断为 IPv4
  • 19:判断为 IPv6
  • 20:判断为私网 IP
  • 21:判断为公网 IP

Property

Integer

0

固定取值为 0,取 HttpObj 的值用于匹配对应详情。

ValueString

string

123

匹配内容。
逻辑关系判断为 IP、 IPv4、 IPv6、私网 IP 或公网 IP 时不需要填写。

返回参数


请求示例

POST https://open.volcengineapi.com/?Action=UpdateCCRule&Version=2020-12-09
X-Date: 20230711T035055Z
Authorization: HMAC-SHA256 Credential=AKLTNGU0OGEyMT***/20230711/cn-beijing/waf/request, SignedHeaders=content-type;x-content-sha256;x-date, Signature=da4fac562d00f41ad8***

{
  "Name": "123456",
  "Url": "/test.html",
  "AdvancedEnable": true,
  "AccurateGroup": {
    "Logic": 1,
    "AccurateRules": [
      {
        "HttpObj": "request.schema",
        "ObjType": 0,
        "Property": 0,
        "Opretar": 2,
        "ValueString": "HTTP"
      }
    ]
  },
  "Field": "CLIENTIP",
  "SingleThreshold": 10,
  "PathThreshold": 100,
  "CountTime": 60,
  "CCType": 1,
  "EffectTime": 60,
  "RulePriority": 0,
  "Enable": 1,
  "Id": 144565,
  "Host": "example.volcwaf001.com"
}

返回示例

{
    "ResponseMetadata": {
        "RequestId": "20231009200242CE25C146B591DDCE****",
        "Action": "UpdateCCRule",
        "Version": "2020-12-09",
        "Service": "waf",
        "Region": "cn-beijing"
    },
    "Result": null
}