华为云用户手册

  • 响应参数 状态码: 200 表10 响应Body参数 参数 参数类型 描述 name String 规则名称 id String Rule ID. policyid String Policy ID. url String 当mode值为0时,该参数有返回值。规则应用的URL链接,不包含域名。 prefix Boolean 路径是否为前缀模式,当防护url以*结束,则为前缀模式。 mode Integer cc规则防护模式,对应console上的mode,现在只支持创建高级cc规则防护模式。 0:标准,只支持对域名的防护路径做限制。 1:高级,支持对路径、IP、Cookie、Header、Params字段做限制。 枚举值: 0 1 conditions Array of CcCondition objects cc规则防护规则限速条件,当cc防护规则为高级模式(mode参数值为1)时,该参数必填。 action action object 请求次数限制到达后采取的防护动作 tag_type String 限速模式: ip:IP限速,根据IP区分单个Web访问者。 cookie:用户限速,根据Cookie键值区分单个Web访问者。 header:用户限速,根据Header区分单个Web访问者。 other:根据Referer(自定义请求访问的来源)字段区分单个Web访问者。 policy: 策略限速 domain: 域名限速 url: url限速 枚举值: ip cookie header other policy domain url tag_index String 用户标识,当限速模式为用户限速(cookie或header)时,需要传该参数。 选择cookie时,设置cookie字段名,即用户需要根据网站实际情况配置唯一可识别Web访问者的cookie中的某属性变量名。用户标识的cookie,不支持正则,必须完全匹配。例如:如果网站使用cookie中的某个字段name唯一标识用户,那么可以选取name字段来区分Web访问者。 选择header时,设置需要防护的自定义HTTP首部,即用户需要根据网站实际情况配置可识别Web访问者的HTTP首部。 tag_condition tag_condition object 用户标识,当限速模式为other时,需要传该参数。根据Referer(自定义请求访问的来源)字段区分单个Web访问者 limit_num Integer 限制频率,单位为次,范围为1~2147483647 limit_period Integer 限速周期,单位为秒,范围1~3600 unlock_num Integer 放行频率,单位为次,范围为0~2147483647。只有当防护动作类型为dynamic_block时,才需要传该参数。 lock_time Integer 阻断时间,单位为秒,范围为0~65535。当“防护动作”选择“阻断”时,可设置阻断后恢复正常访问页面的时间。 domain_aggregation Boolean 是否开启域名聚合统计。 region_aggregation Boolean 是否开启全局计数。 description String 规则描述 total_num Integer 该参数为预留参数,用于后续功能扩展,当前请用户忽略该参数 unaggregation Boolean 该参数为预留参数,用于后续功能扩展,当前请用户忽略该参数 aging_time Integer 规则老化时间,该参数为预留参数,用于后续功能扩展,当前请用户忽略该参数 producer Integer 规则创建对象,该参数为预留参数,用于后续功能扩展,当前请用户忽略该参数 表11 CcCondition 参数 参数类型 描述 category String 字段类型 枚举值: url ip ipv6 params cookie header response_code logic_operation String 条件列表匹配逻辑。 如果字段类型category是url, 匹配逻辑可以为:contain、 not_contain、 equal、 not_equal、 prefix、 not_prefix、 suffix、 not_suffix、 contain_any、 not_contain_all、 equal_any、 not_equal_all、 equal_any、 not_equal_all、 prefix_any、 not_prefix_all、 suffix_any、 not_suffix_all、 len_greater、 len_less、len_equal或者len_not_equal 如果字段类型category是ip或者ipv6,匹配逻辑可以为: equal、not_equal、equal_any或者not_equal_all 如果字段类型category是response_code,匹配逻辑可以为: equal或者not_equal 如果字段类型category是params、cookie或者header, 匹配逻辑可以为:contain、 not_contain、 equal、 not_equal、 prefix、 not_prefix、 suffix、 not_suffix、 contain_any、 not_contain_all、 equal_any、not_equal_all、 equal_any、 not_equal_all、 prefix_any、 not_prefix_all、 suffix_any、 not_suffix_all、 len_greater、 len_less、len_equal、len_not_equal、、num_greater、num_less、num_equal、num_not_equal、exist或者not_exist contents Array of strings 条件列表逻辑匹配内容。当logic_operation参数不以any或者all结尾时,需要传该参数。 value_list_id String 引用表id。当logic_operation参数以any或者all结尾时,需要传该参数。此外,引用表类型要与category类型保持一致。 index String 子字段,当字段类型(category)选择“params”、“cookie”、“header”时,请根据实际需求配置子字段且该参数必填。 表12 action 参数 参数类型 描述 category String 动作类型: captcha:人机验证,阻断后用户需要输入正确的验证码,恢复正确的访问页面。 -block:阻断。 log: 仅记录 dynamic_block: 上一个限速周期内,请求频率超过“限速频率”将被阻断,那么在下一个限速周期内,请求频率超过“放行频率”将被阻断。注:只有当cc防护规则模式为高级模式时才支持设置dynamic_block防护动作。 枚举值: captcha block log dynamic_block detail detail object 阻断页面信息。当防护动作(category)选择阻断(block)或者动态阻断(dynamic_block)时,需要设置返回的阻断页面。 如果需要返回的阻断页面为系统默认的阻断页面,不需要传该参数。 如果用户想防护自定义的阻断页面,可以通过此参数设置 表13 detail 参数 参数类型 描述 response response object 阻断页面 表14 response 参数 参数类型 描述 content_type String 内容类型,值可为“application/json”、“text/html”、“text/xml”。 枚举值: application/json text/html text/xml content String 阻断页面内容 表15 tag_condition 参数 参数类型 描述 category String 用户标识字段,其值固定为referer contents Array of strings 用户标识字段内容 状态码: 400 表16 响应Body参数 参数 参数类型 描述 error_code String 错误码 error_msg String 错误信息 状态码: 401 表17 响应Body参数 参数 参数类型 描述 error_code String 错误码 error_msg String 错误信息 状态码: 500 表18 响应Body参数 参数 参数类型 描述 error_code String 错误码 error_msg String 错误信息
  • 请求参数 表3 请求Header参数 参数 是否必选 参数类型 描述 X-Auth-Token 是 String 用户Token,通过调用IAM服务获取用户Token接口获取(响应消息头中X-Subject-Token的值)。 Content-Type 是 String 内容类型 缺省值:application/json;charset=utf8 表4 请求Body参数 参数 是否必选 参数类型 描述 name 否 String 规则名称 mode 是 Integer cc规则防护模式,对应console上的mode,现在只支持创建高级cc规则防护模式。 0:标准,只支持对域名的防护路径做限制。 1:高级,支持对路径、IP、Cookie、Header、Params字段做限制。 枚举值: 0 1 url 否 String 需要防护的域名路径,当cc防护规则为标准模式(mode参数值为0)时,该参数必填。 conditions 是 Array of CcCondition objects cc规则防护规则限速条件,当cc防护规则为高级模式(mode参数值为1)时,该参数必填。 action 是 action object 请求次数限制到达后采取的防护动作 tag_type 是 String 限速模式: ip:IP限速,根据IP区分单个Web访问者。 cookie:用户限速,根据Cookie键值区分单个Web访问者。 header:用户限速,根据Header区分单个Web访问者。 other:根据Referer(自定义请求访问的来源)字段区分单个Web访问者。 policy: 策略限速 domain: 域名限速 url: url限速 枚举值: ip cookie header other policy domain url tag_index 否 String 用户标识,当限速模式为用户限速(cookie或header)时,需要传该参数。 选择cookie时,设置cookie字段名,即用户需要根据网站实际情况配置唯一可识别Web访问者的cookie中的某属性变量名。用户标识的cookie,不支持正则,必须完全匹配。例如:如果网站使用cookie中的某个字段name唯一标识用户,那么可以选取name字段来区分Web访问者。 选择header时,设置需要防护的自定义HTTP首部,即用户需要根据网站实际情况配置可识别Web访问者的HTTP首部。 tag_condition 否 tag_condition object 用户标识,当限速模式为other时,需要传该参数。根据Referer(自定义请求访问的来源)字段区分单个Web访问者 limit_num 是 Integer 限制频率,单位为次,范围为1~2147483647 limit_period 是 Integer 限速周期,单位为秒,范围1~3600 unlock_num 否 Integer 放行频率,单位为次,范围为0~2147483647。只有当防护动作类型为dynamic_block时,才需要传该参数。 lock_time 否 Integer 阻断时间,单位为秒,范围为0~65535。当“防护动作”选择“阻断”时,可设置阻断后恢复正常访问页面的时间。 domain_aggregation 否 Boolean 是否开启域名聚合统计。 region_aggregation 否 Boolean 是否开启全局计数。 description 否 String 规则描述 表5 CcCondition 参数 是否必选 参数类型 描述 category 是 String 字段类型 枚举值: url ip ipv6 params cookie header response_code logic_operation 是 String 条件列表匹配逻辑。 如果字段类型category是url, 匹配逻辑可以为:contain、 not_contain、 equal、 not_equal、 prefix、 not_prefix、 suffix、 not_suffix、 contain_any、 not_contain_all、 equal_any、 not_equal_all、 equal_any、 not_equal_all、 prefix_any、 not_prefix_all、 suffix_any、 not_suffix_all、 len_greater、 len_less、len_equal或者len_not_equal 如果字段类型category是ip或者ipv6,匹配逻辑可以为: equal、not_equal、equal_any或者not_equal_all 如果字段类型category是response_code,匹配逻辑可以为: equal或者not_equal 如果字段类型category是params、cookie或者header, 匹配逻辑可以为:contain、 not_contain、 equal、 not_equal、 prefix、 not_prefix、 suffix、 not_suffix、 contain_any、 not_contain_all、 equal_any、not_equal_all、 equal_any、 not_equal_all、 prefix_any、 not_prefix_all、 suffix_any、 not_suffix_all、 len_greater、 len_less、len_equal、len_not_equal、、num_greater、num_less、num_equal、num_not_equal、exist或者not_exist contents 否 Array of strings 条件列表逻辑匹配内容。当logic_operation参数不以any或者all结尾时,需要传该参数。 value_list_id 否 String 引用表id。当logic_operation参数以any或者all结尾时,需要传该参数。此外,引用表类型要与category类型保持一致。 index 否 String 子字段,当字段类型(category)选择“params”、“cookie”、“header”时,请根据实际需求配置子字段且该参数必填。 表6 action 参数 是否必选 参数类型 描述 category 是 String 动作类型: captcha:人机验证,阻断后用户需要输入正确的验证码,恢复正确的访问页面。 -block:阻断。 log: 仅记录 dynamic_block: 上一个限速周期内,请求频率超过“限速频率”将被阻断,那么在下一个限速周期内,请求频率超过“放行频率”将被阻断。注:只有当cc防护规则模式为高级模式时才支持设置dynamic_block防护动作。 枚举值: captcha block log dynamic_block detail 否 detail object 阻断页面信息。当防护动作(category)选择阻断(block)或者动态阻断(dynamic_block)时,需要设置返回的阻断页面。 如果需要返回的阻断页面为系统默认的阻断页面,不需要传该参数。 如果用户想防护自定义的阻断页面,可以通过此参数设置 表7 detail 参数 是否必选 参数类型 描述 response 否 response object 返回页面 表8 response 参数 是否必选 参数类型 描述 content_type 否 String 内容类型,值可为“application/json”、“text/html”、“text/xml”。 枚举值: application/json text/html text/xml content 否 String 防护页面内容 表9 tag_condition 参数 是否必选 参数类型 描述 category 否 String 用户标识字段,其值固定为referer contents 否 Array of strings 用户标识字段内容
  • 响应示例 状态码: 200 OK { "id" : "31af669f567246c289771694f2112289", "hostname" : "www.demo.com", "protocol" : "HTTP", "server" : [ { "address" : "x.x.x.x", "port" : 80, "type" : "ipv4", "weight" : 1, "front_protocol" : "HTTP", "back_protocol" : "HTTP" } ], "proxy" : false, "locked" : 0, "timestamp" : 1650527546420, "flag" : { "pci_3ds" : "false", "pci_dss" : "false", "ipv6" : "false", "cname" : "new", "is_dual_az" : "true" }, "description" : "", "policyid" : "41cba8aee2e94bcdbf57460874205494", "domainid" : "d4ecb00b031941ce9171b7bc3386883f", "projectid" : "0456cf04d6f64725ab02ed5bd2efdfa4", "enterprise_project_id" : "0", "protect_status" : 0, "access_status" : 0, "access_code" : "1b18879b9d064f8bbcbf8abce7294cac", "block_page" : { "template" : "default" }, "web_tag" : "", "exclusive_ip" : false, "http2_enable" : false }
  • 响应示例 状态码: 200 请求成功 { "id" : "0619871acb764d48a112695e8f7cbb10", "region" : "region-01-7", "zone" : "region-01-7a", "specification" : "8vCPUs | 16GB", "arch" : "x86", "upgradable" : 0, "status" : 0, "serverId" : "477353dc-8687-4bf4-b45b-1d7fee74fa63", "cloudServiceType" : "hws.service.type.waf", "resourceType" : "hws.resource.type.waf.instance", "resourceSpecCode" : "waf.instance.enterprise", "vpc_id" : "13718074-a3f9-408d-82aa-3c41ef55e589", "subnet_id" : "74d1b5a6-c7eb-4e9a-8372-181212552fcc", "service_ip" : "192.168.10.68", "security_group_ids" : [ "34287bdb-7aba-471a-b041-27427f1af76a" ], "cpu_flavor" : "Si2.2xlarge.2", "run_status" : 2, "access_status" : 1, "instancename" : "0412elb" }
  • 请求参数 表3 请求Header参数 参数 是否必选 参数类型 描述 X-Auth-Token 是 String 用户Token,通过调用IAM服务获取用户Token接口获取(响应消息头中X-Subject-Token的值)。 Content-Type 是 String 内容类型 缺省值:application/json;charset=utf8 表4 请求Body参数 参数 是否必选 参数类型 描述 instancename 是 String 独享引擎新名称
  • 响应参数 状态码: 200 表5 响应Body参数 参数 参数类型 描述 id String 独享引擎实例ID instancename String 独享引擎实例名称 region String 独享引擎实例Region ID zone String 可用区ID arch String CPU架构 cpu_flavor String ECS规格 vpc_id String 独享引擎实例所在VPC ID subnet_id String 独享引擎实例所在VPC的子网ID service_ip String 独享引擎实例的业务面IP security_group_ids Array of strings 独享引擎绑定的安全组 status Integer 独享引擎计费状态 0:正常计费 1:冻结,资源和数据会保留,但租户无法再正常使用云服务 2:终止,资源和数据将清除 run_status Integer 独享引擎运行状态 0:创建中 1:运行中 2:删除中 3:已删除 4:创建失败 5:已冻结 6:异常 7:更新中 8:更新失败 access_status Integer 独享引擎接入状态(0:未接入,1:已接入) upgradable Integer 独享引擎是否可升级(0:不可升级,1:可升级) cloudServiceType String 云服务代码。 仅作为标记,用户可忽略。 resourceType String 云服务资源类型,仅作为标记,用户可忽略。 resourceSpecCode String 云服务资源代码。仅作为标记,用户可忽略。 specification String 独享引擎ECS规格,如"8vCPUs | 16GB" serverId String 独享引擎ECS ID create_time Long 引擎实例创建时间 状态码: 400 表6 响应Body参数 参数 参数类型 描述 error_code String 错误码 error_msg String 错误信息 状态码: 401 表7 响应Body参数 参数 参数类型 描述 error_code String 错误码 error_msg String 错误信息 状态码: 500 表8 响应Body参数 参数 参数类型 描述 error_code String 错误码 error_msg String 错误信息
  • 响应参数 状态码: 200 表4 响应Body参数 参数 参数类型 描述 id String 规则id policyid String 策略id conditions Array of AnticrawlerCondition objects 匹配条件列表 name String 规则名称 type String JS脚本反爬虫规则类型,指定防护路径:anticrawler_specific_url 排除防护路径:anticrawler_except_url timestamp Long 创建规则时间戳 status Integer 规则状态,0:关闭,1:开启 priority Integer 执行该规则的优先级,值越小,优先级越高,值相同时,规则创建时间早,优先级越高。取值范围:0到1000。 表5 AnticrawlerCondition 参数 参数类型 描述 category String 字段类型 枚举值: url user-agent logic_operation String 条件列表匹配逻辑, 包括:contain、not_contain、equal、not_equal、prefix、not_prefix、suffix、not_suffix、contain_any、not_contain_all、equal_any、not_equal_all、prefix_any、not_prefix_all、suffix_any、not_suffix_all contents Array of strings 条件列表逻辑匹配内容。当logic_operation参数不以any或者all结尾时,需要传该参数。 value_list_id String 引用表id。当logic_operation参数以any或者all结尾时,需要传该参数。此外,引用表类型要与category类型保持一致。 状态码: 400 表6 响应Body参数 参数 参数类型 描述 error_code String 错误码 error_msg String 错误信息 状态码: 401 表7 响应Body参数 参数 参数类型 描述 error_code String 错误码 error_msg String 错误信息 状态码: 500 表8 响应Body参数 参数 参数类型 描述 error_code String 错误码 error_msg String 错误信息
  • 响应示例 状态码: 200 ok { "id" : "7e7983bf2c9c41029d642bcbf819346d", "policyid" : "0681f69f94ac408e9688373e45a61fdb", "name" : "test66", "timestamp" : 1678931492172, "status" : 1, "type" : "anticrawler_except_url", "conditions" : [ { "category" : "url", "contents" : [ "/test66" ], "logic_operation" : "contain" } ], "priority" : 50 }
  • 响应示例 状态码: 200 请求成功 { "total" : 1, "items" : [ { "id" : "41cba8aee2e94bcdbf57460874205494", "name" : "policy_2FHwFOKz", "level" : 2, "action" : { "category" : "log" }, "options" : { "webattack" : true, "common" : true, "crawler" : true, "crawler_engine" : false, "crawler_scanner" : true, "crawler_script" : false, "crawler_other" : false, "webshell" : false, "cc" : true, "custom" : true, "whiteblackip" : true, "geoip" : true, "ignore" : true, "privacy" : true, "antitamper" : true, "antileakage" : false, "bot_enable" : true, "modulex_enabled" : false }, "hosts" : [ ], "extend" : { }, "timestamp" : 1650527546218, "full_detection" : false, "bind_host" : [ ] } ] }
  • 请求示例 更新项目id为project_id,引用表id为valuelistid的引用表,引用表名称为“RPmvp0m4”,引用表类型为“response_coderl”,值为“500”,描述为“demo”。 PUT https://{Endpoint}/v1/{project_id}/waf/valuelist/{valuelistid}?enterprise_project_id=0 { "name" : "RPmvp0m4", "type" : "response_code", "values" : [ "500" ], "description" : "demo" }
  • 响应参数 状态码: 200 表5 响应Body参数 参数 参数类型 描述 id String 引用表id name String 引用表名称 type String 引用表类型 description String 引用表描述 values Array of strings 引用表的值 producer Integer 引用表来源: 1:表示来源于用户手动创建 2:表示来源于智能访问控制自动创建 状态码: 400 表6 响应Body参数 参数 参数类型 描述 error_code String 错误码 error_msg String 错误信息 状态码: 401 表7 响应Body参数 参数 参数类型 描述 error_code String 错误码 error_msg String 错误信息 状态码: 500 表8 响应Body参数 参数 参数类型 描述 error_code String 错误码 error_msg String 错误信息
  • 请求参数 表3 请求Header参数 参数 是否必选 参数类型 描述 X-Auth-Token 是 String 用户Token,通过调用IAM服务获取用户Token接口获取(响应消息头中X-Subject-Token的值)。 Content-Type 是 String 内容类型 缺省值:application/json;charset=utf8 表4 请求Body参数 参数 是否必选 参数类型 描述 name 是 String 引用表名称,2-32位字符串组成 最小长度:2 最大长度:32 type 是 String 引用表类型,参见枚举列表 最小长度:2 最大长度:32 枚举值: url params ip cookie referer user-agent header response_code response_header resopnse_body values 否 Array of strings 引用表的值 description 否 String 引用表描述,最长128字符 最小长度:0 最大长度:128
  • 响应示例 状态码: 200 Request succeeded. { "total" : 1, "items" : [ { "id" : "f88c5eabff9b4ff9ba6e7dd8e38128ba", "policyid" : "d471eef691684f1c8d7784532fd8f4bd", "timestamp" : 1678873040603, "name" : "test", "description" : "", "status" : 1, "mode" : 1, "conditions" : [ { "category" : "url", "contents" : [ "/url" ], "logic_operation" : "contain" } ], "action" : { "category" : "captcha" }, "producer" : 1, "unaggregation" : false, "total_num" : 0, "limit_num" : 10, "limit_period" : 60, "lock_time" : 0, "tag_type" : "ip", "aging_time" : 0, "region_aggregation" : false, "domain_aggregation" : false } ] }
  • 响应参数 状态码: 200 表4 响应Body参数 参数 参数类型 描述 total Integer Number of rules in the policy items Array of CcrulesListInfo objects Array of Cc rules 表5 CcrulesListInfo 参数 参数类型 描述 name String 规则名称 id String Rule ID. policyid String Policy ID. url String 当mode值为0时,该参数有返回值。规则应用的URL链接,不包含域名。 prefix Boolean 路径是否为前缀模式,当防护url以*结束,则为前缀模式。当mode值为0时,该参数有返回值。 mode Integer cc规则防护模式,对应console上的mode,现在只支持创建高级cc规则防护模式。 0:标准,只支持对域名的防护路径做限制。 1:高级,支持对路径、IP、Cookie、Header、Params字段做限制。 枚举值: 0 1 status Integer 规则状态,0:关闭,1:开启 conditions Array of CcCondition objects cc规则防护规则限速条件,当cc防护规则为高级模式(mode参数值为1)时,该参数必填。 action action object 请求次数限制到达后采取的防护动作 tag_type String 限速模式: ip:IP限速,根据IP区分单个Web访问者。 cookie:用户限速,根据Cookie键值区分单个Web访问者。 header:用户限速,根据Header区分单个Web访问者。 other:根据Referer(自定义请求访问的来源)字段区分单个Web访问者。 policy: 策略限速 domain: 域名限速 url: url限速 枚举值: ip cookie header other policy domain url tag_index String 用户标识,当限速模式为用户限速(cookie或header)时,需要传该参数。 选择cookie时,设置cookie字段名,即用户需要根据网站实际情况配置唯一可识别Web访问者的cookie中的某属性变量名。用户标识的cookie,不支持正则,必须完全匹配。例如:如果网站使用cookie中的某个字段name唯一标识用户,那么可以选取name字段来区分Web访问者。 选择header时,设置需要防护的自定义HTTP首部,即用户需要根据网站实际情况配置可识别Web访问者的HTTP首部。 tag_condition tag_condition object 用户标识,当限速模式为other时,需要传该参数。根据Referer(自定义请求访问的来源)字段区分单个Web访问者 limit_num Integer 限制频率,单位为次,范围为1~2147483647 limit_period Integer 限速周期,单位为秒,范围1~3600 unlock_num Integer 放行频率,单位为次,范围为0~2147483647。只有当防护动作类型为dynamic_block时,才需要传该参数。 lock_time Integer 阻断时间,单位为秒,范围为0~65535。当“防护动作”选择“阻断”时,可设置阻断后恢复正常访问页面的时间。 domain_aggregation Boolean 是否开启域名聚合统计。 region_aggregation Boolean 是否开启全局计数。 description String 规则描述 total_num Integer 该参数为预留参数,用于后续功能扩展,当前请用户忽略该参数 unaggregation Boolean 该参数为预留参数,用于后续功能扩展,当前请用户忽略该参数 aging_time Integer 规则老化时间,该参数为预留参数,用于后续功能扩展,当前请用户忽略该参数 producer Integer 规则创建对象,该参数为预留参数,用于后续功能扩展,当前请用户忽略该参数 timestamp Long 创建规则时间戳 表6 CcCondition 参数 参数类型 描述 category String 字段类型 枚举值: url ip ipv6 params cookie header response_code logic_operation String 条件列表匹配逻辑。 如果字段类型category是url, 匹配逻辑可以为:contain、 not_contain、 equal、 not_equal、 prefix、 not_prefix、 suffix、 not_suffix、 contain_any、 not_contain_all、 equal_any、 not_equal_all、 equal_any、 not_equal_all、 prefix_any、 not_prefix_all、 suffix_any、 not_suffix_all、 len_greater、 len_less、len_equal或者len_not_equal 如果字段类型category是ip或者ipv6,匹配逻辑可以为: equal、not_equal、equal_any或者not_equal_all 如果字段类型category是response_code,匹配逻辑可以为: equal或者not_equal 如果字段类型category是params、cookie或者header, 匹配逻辑可以为:contain、 not_contain、 equal、 not_equal、 prefix、 not_prefix、 suffix、 not_suffix、 contain_any、 not_contain_all、 equal_any、not_equal_all、 equal_any、 not_equal_all、 prefix_any、 not_prefix_all、 suffix_any、 not_suffix_all、 len_greater、 len_less、len_equal、len_not_equal、、num_greater、num_less、num_equal、num_not_equal、exist或者not_exist contents Array of strings 条件列表逻辑匹配内容。当logic_operation参数不以any或者all结尾时,需要传该参数。 value_list_id String 引用表id。当logic_operation参数以any或者all结尾时,需要传该参数。此外,引用表类型要与category类型保持一致。 index String 子字段,当字段类型(category)选择“params”、“cookie”、“header”时,请根据实际需求配置子字段且该参数必填。 表7 action 参数 参数类型 描述 category String 动作类型: captcha:人机验证,阻断后用户需要输入正确的验证码,恢复正确的访问页面。 -block:阻断。 log: 仅记录 dynamic_block: 上一个限速周期内,请求频率超过“限速频率”将被阻断,那么在下一个限速周期内,请求频率超过“放行频率”将被阻断。注:只有当cc防护规则模式为高级模式时才支持设置dynamic_block防护动作。 枚举值: captcha block log dynamic_block detail detail object 阻断页面信息。当防护动作(category)选择阻断(block)或者动态阻断(dynamic_block)时,需要设置返回的阻断页面。 如果需要返回的阻断页面为系统默认的阻断页面,不需要传该参数。 如果用户想防护自定义的阻断页面,可以通过此参数设置 表8 detail 参数 参数类型 描述 response response object 阻断页面 表9 response 参数 参数类型 描述 content_type String 内容类型,值可为“application/json”、“text/html”、“text/xml”。 枚举值: application/json text/html text/xml content String 阻断页面内容 表10 tag_condition 参数 参数类型 描述 category String 用户标识字段,其值固定为referer contents Array of strings 用户标识字段内容 状态码: 400 表11 响应Body参数 参数 参数类型 描述 error_code String 错误码 error_msg String 错误信息 状态码: 401 表12 响应Body参数 参数 参数类型 描述 error_code String 错误码 error_msg String 错误信息 状态码: 500 表13 响应Body参数 参数 参数类型 描述 error_code String 错误码 error_msg String 错误信息
  • 状态码 正常 返回值 说明 200 请求成功。 异常 状态码 编码 说明 400 Bad Request 服务器未能处理请求。 401 Unauthorized 被请求的页面需要用户名和密码。 403 Forbidden 对被请求页面的访问被禁止。 404 Not Found 服务器无法找到被请求的页面。 405 Method Not Allowed 请求中指定的方法不被允许。 406 Not Acceptable 服务器生成的响应无法被客户端所接受。 407 Proxy Authentication Required 用户必须首先使用代理服务器进行验证,这样请求才会被处理。 408 Request Timeout 请求超出了服务器的等待时间。 409 Conflict 由于冲突,请求无法被完成。 500 Internal Server Error 请求未完成,服务异常。 501 Not Implemented 请求未完成,服务器不支持所请求的功能。 502 Bad Gateway 请求未完成,服务器从上游服务器收到一个无效的响应。 503 Service Unavailable 请求未完成,系统暂时异常。 504 Gateway Timeout 网关超时。 父主题: 附录
  • 请求参数 表3 请求Header参数 参数 是否必选 参数类型 描述 X-Auth-Token 是 String 用户Token,通过调用IAM服务获取用户Token接口获取(响应消息头中X-Subject-Token的值)。 Content-Type 是 String 内容类型 缺省值:application/json;charset=utf8 表4 请求Body参数 参数 是否必选 参数类型 描述 project_id 是 String 项目id is_auto_pay 是 Boolean 是否自动支付 false: 否(需要客户手动去支付) true:是(自动支付) is_auto_renew 是 Boolean 是否自动续订 true:自动续订 false:不自动续订 region_id 是 String region Id waf_product_info 否 WafProductInfo object 购买waf信息 domain_expack_product_info 否 ExpackProductInfo object 购买域名扩展包信息 bandwidth_expack_product_info 否 ExpackProductInfo object 购买带宽扩展包信息 rule_expack_product_info 否 ExpackProductInfo object 购买规则扩展包信息 表5 WafProductInfo 参数 是否必选 参数类型 描述 resource_spec_code 否 String waf规格 detection: 入门 (仅在北京四、北京一、上海二、上海一、广州以及广州-友好用户环境支持入门版) professional:标准 enterprise:专业 ultimate:铂金版 period_type 否 String 订购周期类型 month: 月;year: 年 period_num 否 Integer 订购周期数 表6 ExpackProductInfo 参数 是否必选 参数类型 描述 resource_size 否 Integer 扩展包数量
  • 请求示例 在项目id为“550500b49078408682d0d4f7d923f3e1”的项目中购买包周期云模式waf,waf不自动续订,不自动支付,region Id为"cn-north-7",带宽扩展包的扩展包数量为“1”。 POST https://{Endpoint}/v1/{project_id}/waf/subscription/purchase/prepaid-cloud-waf?enterprise_project_id=0 { "project_id" : "550500b49078408682d0d4f7d923f3e1", "is_auto_renew" : false, "is_auto_pay" : false, "region_id" : "cn-north-7", "bandwidth_expack_product_info" : { "resource_size" : 1 } }
  • 响应参数 状态码: 200 表7 响应Body参数 参数 参数类型 描述 orderId String 订单id 状态码: 400 表8 响应Body参数 参数 参数类型 描述 error_code String 错误码 error_msg String 错误信息 状态码: 401 表9 响应Body参数 参数 参数类型 描述 error_code String 错误码 error_msg String 错误信息 状态码: 500 表10 响应Body参数 参数 参数类型 描述 error_code String 错误码 error_msg String 错误信息
  • 响应示例 状态码: 200 Request succeeded. { "id" : "f88c5eabff9b4ff9ba6e7dd8e38128ba", "policyid" : "d471eef691684f1c8d7784532fd8f4bd", "name" : "test55", "timestamp" : 1678873040603, "description" : "", "status" : 1, "mode" : 1, "conditions" : [ { "category" : "url", "contents" : [ "/url" ], "logic_operation" : "contain" } ], "action" : { "category" : "captcha" }, "producer" : 1, "unaggregation" : false, "total_num" : 0, "limit_num" : 10, "limit_period" : 60, "lock_time" : 0, "tag_type" : "ip", "aging_time" : 0, "region_aggregation" : false, "domain_aggregation" : false }
  • 响应参数 状态码: 200 表4 响应Body参数 参数 参数类型 描述 name String 规则名称 id String Rule ID. policyid String Policy ID. url String 当mode值为0时,该参数有返回值。规则应用的URL链接,不包含域名。 prefix Boolean 路径是否为前缀模式,当防护url以*结束,则为前缀模式。 mode Integer cc规则防护模式,对应console上的mode,现在只支持创建高级cc规则防护模式。 0:标准,只支持对域名的防护路径做限制。 1:高级,支持对路径、IP、Cookie、Header、Params字段做限制。 枚举值: 0 1 status Integer 规则状态,0:关闭,1:开启 conditions Array of CcCondition objects cc规则防护规则限速条件,当cc防护规则为高级模式(mode参数值为1)时,该参数必填。 action action object 请求次数限制到达后采取的防护动作 tag_type String 限速模式: ip:IP限速,根据IP区分单个Web访问者。 cookie:用户限速,根据Cookie键值区分单个Web访问者。 header:用户限速,根据Header区分单个Web访问者。 other:根据Referer(自定义请求访问的来源)字段区分单个Web访问者。 policy: 策略限速 domain: 域名限速 url: url限速 枚举值: ip cookie header other policy domain url tag_index String 用户标识,当限速模式为用户限速(cookie或header)时,需要传该参数。 选择cookie时,设置cookie字段名,即用户需要根据网站实际情况配置唯一可识别Web访问者的cookie中的某属性变量名。用户标识的cookie,不支持正则,必须完全匹配。例如:如果网站使用cookie中的某个字段name唯一标识用户,那么可以选取name字段来区分Web访问者。 选择header时,设置需要防护的自定义HTTP首部,即用户需要根据网站实际情况配置可识别Web访问者的HTTP首部。 tag_condition tag_condition object 用户标识,当限速模式为other时,需要传该参数。根据Referer(自定义请求访问的来源)字段区分单个Web访问者 limit_num Integer 限制频率,单位为次,范围为1~2147483647 limit_period Integer 限速周期,单位为秒,范围1~3600 unlock_num Integer 放行频率,单位为次,范围为0~2147483647。只有当防护动作类型为dynamic_block时,才需要传该参数。 lock_time Integer 阻断时间,单位为秒,范围为0~65535。当“防护动作”选择“阻断”时,可设置阻断后恢复正常访问页面的时间。 domain_aggregation Boolean 是否开启域名聚合统计。 region_aggregation Boolean 是否开启全局计数。 description String 规则描述 total_num Integer 该参数为预留参数,用于后续功能扩展,当前请用户忽略该参数 unaggregation Boolean 该参数为预留参数,用于后续功能扩展,当前请用户忽略该参数 aging_time Integer 规则老化时间,该参数为预留参数,用于后续功能扩展,当前请用户忽略该参数 producer Integer 规则创建对象,该参数为预留参数,用于后续功能扩展,当前请用户忽略该参数 timestamp Long 创建规则时间戳 表5 CcCondition 参数 参数类型 描述 category String 字段类型 枚举值: url ip ipv6 params cookie header response_code logic_operation String 条件列表匹配逻辑。 如果字段类型category是url, 匹配逻辑可以为:contain、 not_contain、 equal、 not_equal、 prefix、 not_prefix、 suffix、 not_suffix、 contain_any、 not_contain_all、 equal_any、 not_equal_all、 equal_any、 not_equal_all、 prefix_any、 not_prefix_all、 suffix_any、 not_suffix_all、 len_greater、 len_less、len_equal或者len_not_equal 如果字段类型category是ip或者ipv6,匹配逻辑可以为: equal、not_equal、equal_any或者not_equal_all 如果字段类型category是response_code,匹配逻辑可以为: equal或者not_equal 如果字段类型category是params、cookie或者header, 匹配逻辑可以为:contain、 not_contain、 equal、 not_equal、 prefix、 not_prefix、 suffix、 not_suffix、 contain_any、 not_contain_all、 equal_any、not_equal_all、 equal_any、 not_equal_all、 prefix_any、 not_prefix_all、 suffix_any、 not_suffix_all、 len_greater、 len_less、len_equal、len_not_equal、、num_greater、num_less、num_equal、num_not_equal、exist或者not_exist contents Array of strings 条件列表逻辑匹配内容。当logic_operation参数不以any或者all结尾时,需要传该参数。 value_list_id String 引用表id。当logic_operation参数以any或者all结尾时,需要传该参数。此外,引用表类型要与category类型保持一致。 index String 子字段,当字段类型(category)选择“params”、“cookie”、“header”时,请根据实际需求配置子字段且该参数必填。 表6 action 参数 参数类型 描述 category String 动作类型: captcha:人机验证,阻断后用户需要输入正确的验证码,恢复正确的访问页面。 -block:阻断。 log: 仅记录 dynamic_block: 上一个限速周期内,请求频率超过“限速频率”将被阻断,那么在下一个限速周期内,请求频率超过“放行频率”将被阻断。注:只有当cc防护规则模式为高级模式时才支持设置dynamic_block防护动作。 枚举值: captcha block log dynamic_block detail detail object 阻断页面信息。当防护动作(category)选择阻断(block)或者动态阻断(dynamic_block)时,需要设置返回的阻断页面。 如果需要返回的阻断页面为系统默认的阻断页面,不需要传该参数。 如果用户想防护自定义的阻断页面,可以通过此参数设置 表7 detail 参数 参数类型 描述 response response object 阻断页面 表8 response 参数 参数类型 描述 content_type String 内容类型,值可为“application/json”、“text/html”、“text/xml”。 枚举值: application/json text/html text/xml content String 阻断页面内容 表9 tag_condition 参数 参数类型 描述 category String 用户标识字段,其值固定为referer contents Array of strings 用户标识字段内容 状态码: 400 表10 响应Body参数 参数 参数类型 描述 error_code String 错误码 error_msg String 错误信息 状态码: 401 表11 响应Body参数 参数 参数类型 描述 error_code String 错误码 error_msg String 错误信息 状态码: 500 表12 响应Body参数 参数 参数类型 描述 error_code String 错误码 error_msg String 错误信息
  • 请求示例 查询项目id为project_id,时间从2022-04-21 00:00:00到2022-04-21 14:35:36,异常状态码为“404”的业务异常TOP统计信息 GET https://{Endpoint}/v1/{project_id}/waf/overviews/abnormal?enterprise_project_id=0&from=1650470400089&to=1650523520089&top=10&code=404
  • 响应示例 状态码: 200 ok { "total" : 2, "items" : [ { "key" : "/", "num" : 6, "host" : "hkh4.test.418lab.cn" }, { "key" : "/", "num" : 6, "host" : "ces_after.test.418lab.cn" } ] }
  • 响应参数 状态码: 200 表4 响应Body参数 参数 参数类型 描述 total Integer 异常请求数量 items Array of UrlCountItem objects 异常请求信息数组 表5 UrlCountItem 参数 参数类型 描述 key String 攻击类型 num Integer 数量 host String 防护域名 状态码: 400 表6 响应Body参数 参数 参数类型 描述 error_code String 错误码 error_msg String 错误信息 状态码: 401 表7 响应Body参数 参数 参数类型 描述 error_code String 错误码 error_msg String 错误信息 状态码: 500 表8 响应Body参数 参数 参数类型 描述 error_code String 错误码 error_msg String 错误信息
  • 请求示例 更新项目id为project_id,防护策略id为policy_id,规则id为rule_id的全局白名单(原误报屏蔽)防护规则。修改防护条件为url包含”/test“,需要屏蔽的规则为网站木马和其他类型攻击,配置高级配置项为全部参数。 PUT https://{Endpoint}/v1/{project_id}/waf/policy/{policy_id}/ignore/{rule_id} { "domain" : [ ], "mode" : 1, "description" : "", "conditions" : [ { "category" : "url", "logic_operation" : "contain", "index" : null, "contents" : [ "/test" ] } ], "rule" : "webshell;vuln", "advanced" : { "index" : "params", "contents" : [ ] } }
  • 响应示例 状态码: 200 请求成功 { "id" : "16e81d9a9e0244359204d7f00326ee4f", "policyid" : "0681f69f94ac408e9688373e45a61fdb", "timestamp" : 1679106005786, "description" : "", "status" : 1, "rule" : "webshell;vuln", "mode" : 1, "conditions" : [ { "category" : "url", "contents" : [ "/test" ], "logic_operation" : "contain" } ], "domain" : [ ], "advanced" : { "index" : "params", "contents" : [ ] } }
  • 响应参数 状态码: 200 表4 响应Body参数 参数 参数类型 描述 total Integer 网页防篡改规则总条数 items Array of AntiTamperRuleResponseBody objects 网页防篡改规则数组 表5 AntiTamperRuleResponseBody 参数 参数类型 描述 id String 规则id policyid String 该规则所属防护策略的id timestamp Long 创建规则的时间戳 description String 该规则备注 status Integer 规则状态,0:关闭,1:开启 hostname String 防篡改的域名 url String 防篡改的url 状态码: 400 表6 响应Body参数 参数 参数类型 描述 error_code String 错误码 error_msg String 错误信息 状态码: 401 表7 响应Body参数 参数 参数类型 描述 error_code String 错误码 error_msg String 错误信息 状态码: 500 表8 响应Body参数 参数 参数类型 描述 error_code String 错误码 error_msg String 错误信息
  • 响应示例 状态码: 200 OK { "total" : 1, "items" : [ { "id" : "b77c3182957b46ed8f808a1998245cc4", "policyid" : "bdba8e224cbd4d11915f244c991d1720", "timestamp" : 1647499571037, "description" : "", "status" : 0, "hostname" : "www.demo.com", "url" : "/sdf" } ] }
  • 响应示例 状态码: 200 OK { "id" : "38ff0cb9a10e4d5293c642bc0350fa6d", "name" : "demo", "level" : 2, "action" : { "category" : "log" }, "options" : { "webattack" : true, "common" : true, "crawler" : true, "crawler_engine" : false, "crawler_scanner" : true, "crawler_script" : false, "crawler_other" : false, "webshell" : false, "cc" : true, "custom" : true, "whiteblackip" : true, "geoip" : true, "ignore" : true, "privacy" : true, "antitamper" : true, "antileakage" : false, "bot_enable" : true, "modulex_enabled" : false }, "hosts" : [ ], "extend" : { }, "timestamp" : 1650529538732, "full_detection" : false, "bind_host" : [ ] }
  • 请求参数 表3 请求Header参数 参数 是否必选 参数类型 描述 X-Auth-Token 是 String 用户Token,通过调用IAM服务获取用户Token接口获取(响应消息头中X-Subject-Token的值)。 Content-Type 是 String 内容类型 缺省值:application/json;charset=utf8 表4 请求Body参数 参数 是否必选 参数类型 描述 name 是 String 策略名称(策略名称只能由数字、字母和下划线组成,长度不能超过64为字符)
  • 响应示例 状态码: 200 Request succeeded. { "id" : "f88c5eabff9b4ff9ba6e7dd8e38128ba", "policyid" : "d471eef691684f1c8d7784532fd8f4bd", "name" : "test55", "timestamp" : 1678873040603, "description" : "", "status" : 1, "mode" : 1, "conditions" : [ { "category" : "url", "contents" : [ "/url" ], "logic_operation" : "contain" } ], "action" : { "category" : "captcha" }, "producer" : 1, "unaggregation" : false, "total_num" : 0, "limit_num" : 10, "limit_period" : 60, "lock_time" : 0, "tag_type" : "ip", "aging_time" : 0, "region_aggregation" : false, "domain_aggregation" : false }
共100000条