調用BatchCreateDcdnWafRules設定WAF防護規則。
介面說明
單使用者調用頻率:20 次/秒。
調試
您可以在OpenAPI Explorer中直接運行該介面,免去您計算簽名的困擾。運行成功後,OpenAPI Explorer可以自動產生SDK程式碼範例。
調試
授權資訊
|
操作 |
存取層級 |
資源類型 |
條件關鍵字 |
關聯操作 |
|
dcdn:BatchCreateDcdnWafRules |
create |
*全部資源
|
無 | 無 |
請求參數
|
名稱 |
類型 |
必填 |
描述 |
樣本值 |
| PolicyId |
integer |
是 |
防護策略 ID。 |
1000001 |
| RuleConfigs |
string |
是 |
防護規則配置。 |
[{"name":"example","action":"monitor","conditions":[{"key":"URL","opValue":"match-one","values":"1,2,3,4,5"},{"key":"Header","opValue":"contain-one","subKey":"example_subkey","values":"6,7,8,9,10"}],"ratelimit":{"target":"header","interval":10,"threshold":5,"ttl":1800,"subKey":"example_subkey","status":{"code":"502","count":5}},"ccStatus":"on","effect":"rule","status":"on"}] |
RuleConfigs 取值說明
RuleConfigs 為列表切片,其中每個結構體代表一條規則。
根據 PolicyId 對應的防護策略類型不同,RuleConfigs 的格式也不同。
防護情境 1:Web 正則防護(waf_group)
參數 | 類型 | 必要 | 樣本值 | 描述 |
status | String | 否 | on | 防護規則開關,取值:on(開啟),off(關閉)。預設為 on。 |
action | String | 是 | block | 規則動作,取值:block(攔截),monitor(觀察)。 |
wafGroupIds | String | 否 | 1012 | WAF 規則群組 ID,預設為"1012",多個 ID 使用半形逗號(,)分隔。 |
waf_group 配置樣本:
// Web 正則防護目前僅支援一條策略下配置一條規則。
[
{
"status": "on",
"action": "block"
}
]
防護情境 2:自訂規則(custom_acl)
名稱 | 類型 | 是否必選 | 樣本值 | 描述 |
name | string | 是 | acl_1 | 防護規則名稱,支援輸入英文字元(大小寫)、數字(0~9)及底線(_),最大輸入 64 個字元。 |
status | string | 否 | on | 取值:on(開啟),off(關閉)。預設為 on。 |
conditions | Condition | 是 | [ {"key": "URI", "subKey": "","opValue": "contain", "values": "/login.php" }] | 觸發規則條件,具體參數請參考表 1 Condition 參數說明。 |
ccStatus | string | 是 | off | 頻次控制開關,on(開啟),off(關閉)。 |
rateLimit | RateLimit | 否 | { "target": "Header", "subKey": "User-Agent", "interval": 5, "threshold": 2, "ttl": 1800} | 具體的頻次控制規則,當 ccStatus 為 on 時必填。具體參數請參考表 2 RateLimit 參數說明。 |
effect | string | 否 | service | 頻次控制黑名單的生效範圍,當 ccStatus 為 on 時必填,取值:rule(當前規則生效),service(全域生效)。 |
action | string | 是 | deny | 規則動作,取值:deny(攔截)、js(JS 驗證)、monitor(觀察)。 |
表 1 Condition 參數說明
名稱 | 類型 | 是否必選 | 樣本值 | 描述 |
Key | string | 是 | Query String Parameter | 匹配欄位,具體請參考 DescribeDcdnWafFilterInfo 。 |
subKey | string | 否 | action | 匹配子欄位,具體請參考 DescribeDcdnWafFilterInfo 。 |
opValue | String | 是 | eq | 邏輯符,具體請參考 DescribeDcdnWafFilterInfo 。 |
values | String | 否 | js | 匹配內容,多值使用英文逗號(,)分隔,具體值參考 DescribeDcdnWafFilterInfo 。 |
表 2 RateLimit 參數說明
名稱 | 類型 | 是否必選 | 樣本值 | 描述 |
target | string | 是 | Header | 頻次控制的統計欄位,取值:IP:表示統計同一個 IP 發起請求的頻率。Header:表示統計包含指定 Header 的請求的頻率。Query String Parameter:表示統計包含指定參數的請求的頻率。Cookie Name:表示統計包含指定 Cookie 的請求的頻率。Session:表示統計來自同一個會話發起請求的頻率。 |
subKey | string | 否 | User-Agent | 統一欄位的子欄位,當 target 為 Header、Query String Parameter 或 Cookie Name 時必填。 |
Interval | Integer | 是 | 5 | 統計時間長度。取值範圍:5~1800。單位:秒。 |
threshold | Integer | 是 | 2 | 統計閾值。取值範圍:2~500000。單位:次。 |
ttl | Integer | 是 | 1800 | 黑名單逾時時間。取值範圍:60~86400。單位:秒。 |
status | RateLimitStatus | 否 | {"code": "404", "ratio": 10} | 響應碼統計。具體參數請參考表 3 RateLimitStatus 參數說明。 |
表 3 RateLimitStatus 參數說明
名稱 | 類型 | 是否必選 | 樣本值 | 描述 |
codet | string | 是 | 404 | HTTP 狀態代碼。 |
ratio | Integer | 否 | 10 | 按比例(%)統計。取值:1~100,與 count 欄位二選一。 |
count | Integer | 否 | 10 | 按數量統計。取值:2~50000,與 ratio 欄位二選一。 |
custom_acl 配置樣本:
[
// 存取控制
{
"name": "acl_1",
"status": "off",
"conditions":
[
{
"key": "Query String Parameter",
"subKey": "action",
"opValue": "eq",
"values": "js"
}
],
"ccStatus": "off",
"action": "js"
},
// 頻次控制
{
"name": "cc_1",
"status": "on",
"conditions":
[
{
"key": "URI",
"subKey": "",
"opValue": "contain",
"values": "/login.php"
},
{
"key": "IP",
"subKey": "",
"opValue": "ip-contain",
"values": "192.168.0.1/24"
}
],
"ccStatus": "on",
"ratelimit":
{
"target": "Header",
"subKey": "User-Agent",
"interval": 5,
"threshold": 2,
"ttl": 1800,
"status":
{
"code": "404",
"ratio": 10
}
},
"effect": "service",
"action": "deny"
}
]
防護情境 3:白名單(whitelist)
名稱 | 類型 | 是否必選 | 樣本值 | 描述 |
name | string | 是 | on | 防護規則名稱,支援輸入英文字元(大小寫)、數字(0~9)及底線(_),最大輸入 64 個字元。 |
status | string | 否 | on | 防護規則開關,取值:on(預設):開啟。off:關閉。 |
conditions | Condition | 是 | [{ "key": "Http-Method","subKey": "","opValue": "match-one", "values": "GET,POST,DELETE" }] | 觸發規則的條件。具體參數請參考表 1 Condition 參數說明。 |
tags | String | 是 | [ "waf_group", "custom_acl"] | 防護策略類型列表。 |
regularTypes | String | 否 | [ [ "sqli", "xss","code_exec", "crlf", "lfilei", "rfilei", "webshell","vvip", "other"] | 正則規則類型,當 tags 中出現 waf_group 時,此值可填,可選值:["sqli", "xss", "code_exec", "crlf", "lfilei", "rfilei", "webshell", "vvip", "other"]。 |
regularRules | String | 否 | [ "100001", "100002", "100003"] | 正則規則,當 tags 中出現 waf_group 時,此值可填,且與 regularTypes 只能出現一個,值為字串格式的六位元字組成的列表。 |
whitelist 配置樣本:
[
// 跳過全部情境
{
"name": "wl_all",
"status": "on",
"conditions":
[
{
"key": "Http-Method",
"subKey": "",
"opValue": "match-one",
"values": "GET,POST,DELETE"
}
],
"tags":
[
"waf_group",
"custom_acl",
"ip_blacklist",
"region_block"
]
},
// 跳過 waf_group 的指定規則 id
{
"name": "wl_waf_id",
"status": "off",
"conditions":
[
{
"key": "Cookie Name",
"subKey": "cdn-sec",
"opValue": "prefix-match",
"values": "a7sdsa9dsa8d8sa"
},
{
"key": "Referer",
"subKey": "",
"opValue": "none",
"values": ""
}
],
"tags":
[
"waf_group"
],
"regularRules":
[
"100001",
"100002",
"100003"
]
},
{
// 跳過 waf_group 的指定規則類型
"name": "wl_waf_type",
"status": "on",
"conditions":
[
{
"key": "Query String",
"subKey": "",
"opValue": "exists",
"values": ""
}
],
"tags":
[
"waf_group"
],
"regularTypes":
[
"sqli",
"xss",
"code_exec",
"crlf",
"lfilei",
"rfilei",
"webshell",
"vvip",
"other"
]
},
// 跳過自訂規則
{
"name": "wl_custom_acl",
"status": "on",
"conditions":
[
{
"key": "Http-Method",
"subKey": "",
"opValue": "match-one",
"values": "GET,POST,DELETE"
}
],
"tags":
[
"custom_acl"
]
},
// 跳過 IP 黑名單
{
"name": "wl_ip_blacklist",
"status": "on",
"conditions":
[
{
"key": "Http-Method",
"subKey": "",
"opValue": "match-one",
"values": "GET,POST,DELETE"
}
],
"tags":
[
"ip_blacklist"
]
},
// 跳過地區封鎖
{
"name": "wl_region_block",
"status": "on",
"conditions":
[
{
"key": "Http-Method",
"subKey": "",
"opValue": "match-one",
"values": "GET,POST,DELETE"
}
],
"tags":
[
"region_block"
]
}
]
防護情境 4:IP 黑名單(ip_blacklist)
名稱 | 類型 | 是否必選 | 樣本值 | 描述 |
name | string | 是 | ipblacklist | 防護規則名稱,支援輸入英文字元(大小寫)、數字(0~9)及底線(_),最大輸入 64 個字元。 |
status | string | 否 | on | 防護規則開關,取值:取值:on(開啟),off(關閉)。預設為 on。 |
remoteAddr | []String | 是 | ["192.168.0.1","10.10.10.10/24","::1","abcd::abcd","BCDE::BCDE"] | 按 IP 位址過濾,具體請參見 DescribeDcdnWafFilterInfo 。 |
action | string | 是 | deny | 規則動作,取值:deny(攔截),monitor(觀察)。 |
ipblacklist 配置樣本:
[
{
"name": "ipblacklist",
"status": "on",
"remoteAddr": ["192.168.0.1","10.10.10.10/24","::1","abcd::abcd","BCDE::BCDE"],
"action": "deny"
}
]
防護情境 5:地區封鎖(region_block)
名稱 | 類型 | 是否必選 | 樣本值 | 描述 |
status | string | 否 | on | 防護規則開關,取值:on(開啟),off(關閉)。預設為 on。 |
cnRegionList | string | 否 | 110000,TW,MO | 中國境內封鎖地區,逗號分隔。支援封鎖的地區請參見 DescribeDcdnWafGeoInfo 。 |
otherRegionList | string | 否 | JP,GB | 中國境外封鎖地區,逗號分隔。支援封鎖的地區請參見 DescribeDcdnWafGeoInfo 。 |
action | string | 是 | deny | 規則動作,取值:deny(攔截),monitor(觀察)。 |
cnRegionList 和 otherRegionList 至少填寫其中一個。
region_block 配置樣本:
[
{
"status": "on",
"cnRegionList": "110000,TW,MO",
"otherRegionList": "JP,GB",
"action": "deny"
}
]
防護情境 6:Bot 管理(bot)
規則模板
所有的規則參數都是以下四個,具體值參見具體規則分類。
參數 | 類型 | 必要 | 描述 |
type | String | 是 | 規則類型,參見具體規則分類。 |
status | String | 是 | 規則狀態,取值:on(開啟),off(關閉)。 |
config | TargetType | 否 | 規則配置,參見具體規則分類。 |
action | String | 否 | 規則動作,參見具體規則分類。 |
規則分類一:防護目標類型
參數 | 類型 | 必要 | 樣本值 | 描述 |
type | String | 是 | target_type | 規則類型,取值:target_type。 |
status | String | 是 | on | 規則開關,取值:on(開啟)。 |
config | TargetType | 否 | {"target":"app"} | 規則配置。格式如下: |
action | String | 否 | 置空 | 規則動作,此處不涉及,置為空白值。 |
防護目標類型配置樣本:
[
{
"type":"target_type",
"status":"on",
"config":{"target":"app"},
"action":""
}
]
規則分類二:Web SDK 整合
參數 | 類型 | 必要 | 樣本值 | 描述 |
type | String | 是 | web_sdk | 規則類型,取值:web_sdk。 |
status | String | 是 | on | 規則開關,取值:on(開啟)。 |
config | WebSdk | 否 | {"mode":"automatic","crossDomain":"example.com"} | 規則配置。格式如下: |
action | String | 否 | 置空 | 規則動作,此處不涉及,置為空白值。 |
Web SDK 整合配置樣本:
[
{
"type":"web_sdk",
"status":"on",
"config":{"mode":"automatic","crossDomain":"example.com"},
"action":""
}
]
規則分類三:防護目標特徵
參數 | 類型 | 必要 | 樣本值 | 描述 |
type | String | 是 | traffic_feature | 規則類型,取值:traffic_feature。 |
status | String | 是 | on | 規則開關,取值:on(開啟)。 |
config | TrafficFeature | 是 | {"conditions":[{"key":"Header","subKey":"User-Agent","opValue":"contain","values":"Chrome"},{"key":"IP","subKey":"","opValue":"ip-contain","values":"192.168.0.1/24"}]} | 規則配置。具體請參見 condition。 |
action | String | 否 | 置空 | 規則動作,此處不涉及,置為空白值。 |
condition(匹配條件)
參數 | 類型 | 必要 | 樣本值 | 描述 |
key | String | 是 | Header | 匹配欄位,具體值請參見 DescribeDcdnWafFilterInfo 。 |
subKey | String | 否 | User-Agent | 匹配子欄位,具體值請參見 DescribeDcdnWafFilterInfo 。 |
opValue | String | 是 | contain | 操作符,具體值請參見 DescribeDcdnWafFilterInfo 。 |
values | String | 否 | Chrome | 匹配內容,多值使用英文逗號分隔,具體值請參見 DescribeDcdnWafFilterInfo 。 |
防護目標特徵配置樣本:
[
{
"type":"traffic_feature",
"status":"on",
"config":{"conditions":[{"key":"Header","subKey":"User-Agent","opValue":"contain","values":"Chrome"},{"key":"IP","subKey":"","opValue":"ip-contain","values":"192.168.0.1/24"}]},
"action":""
}
]
規則分類四:合法 Bot 管理
參數 | 類型 | 必要 | 樣本值 | 描述 |
type | String | 是 | intelligence_crawler | 規則類型,取值:intelligence_crawler。 |
status | String | 是 | on | 規則開關,取值:on(開啟)。 |
config | IntelligenceCrawler | 否 | {"name":"intelligence_crawler_baidu"} | 規則配置。取值請參見name(搜尋引擎蜘蛛白名單)。 |
action | String | 是 | bypass | 規則動作,取值:bypass(允許存取)。 |
name(搜尋引擎蜘蛛白名單)
參數值 | 含義 |
intelligence_crawler_all | 合法搜尋引擎白名單(Google、Bing、百度、搜狗、360、Yandex) |
intelligence_crawler_baidu | 百度蜘蛛白名單 |
intelligence_crawler_sogou | 搜狗蜘蛛白名單 |
intelligence_crawler_360 | 360 蜘蛛白名單 |
intelligence_crawler_google | Google 蜘蛛白名單 |
intelligence_crawler_bing | Bing 蜘蛛白名單 |
intelligence_crawler_yandex | andex 蜘蛛白名單 |
合法 Bot 管理配置樣本:
[
{
"type":"intelligence_crawler",
"status":"on",
"config":{"name":"intelligence_crawler_baidu"},
"action":"bypass"
},
{
"type":"intelligence_crawler",
"status":"on",
"config":{"name":"intelligence_crawler_google"},
"action":"bypass"
}
]
規則分類五:簡單指令碼過濾(JavaScript 挑戰)
參數 | 類型 | 必要 | 樣本值 | 描述 |
type | String | 是 | js | 規則類型,取值:js。 |
status | String | 是 | on | 規則開關,取值:on(開啟),off(關閉)。 |
config | Js | 否 | 置空 | 規則配置,此處不涉及,置為空白值。 |
action | String | 是 | js | 規則動作,取值:js(JS 校正)。 |
簡單指令碼過濾(JavaScript 挑戰)配置樣本:
[
{
"type":"js",
"status":"on",
"config":{},
"action":"js"
}
]
規則分類六:進階 Bot 防禦(動態令牌挑戰)
參數 | 類型 | 必要 | 樣本值 | 描述 |
type | String | 是 | sigchl | 規則類型,取值:sigchl。 |
status | String | 是 | on | 規則開關,取值:on(開啟),off(關閉)。 |
config | Sigchl | 否 | {"sigchl":["sig","replay","driver"]} | 規則配置,格式如下: |
action | String | 是 | sigchl | 規則動作,取值:sigchl(攔截)。 |
進階 Bot 防禦(動態令牌挑戰)配置樣本:
[
{
"type":"sigchl",
"status":"on",
"config":{"sigchl":["sig","replay","driver"]},
"action":"sigchl"
}
]
規則分類七:AI 智能防護
參數 | 類型 | 必要 | 樣本值 | 描述 |
type | String | 是 | algorithm | 規則類型,取值:algorithm。 |
status | String | 是 | on | 規則開關,取值:on(開啟),off(關閉)。 |
config | Algorithm | 否 | 置空 | 規則配置,此處不涉及,置為空白值。 |
action | String | 是 | captcha | 規則動作,取值:monitor(觀察),captcha(滑塊校正)。 |
AI 智能防護配置樣本:
[
{
"type":"algorithm",
"status":"on",
"config":{},
"action":"captcha"
}
]
規則分類八:IP 限速
參數 | 類型 | 必要 | 樣本值 | 描述 |
type | String | 是 | custom_cc_ip | 規則類型,取值:custom_cc_ip。 |
status | String | 是 | on | 規則開關,取值:on(開啟),off(關閉)。 |
config | CustomCcIp | 是 | {"interval":20,"target":"IP","threshold":50,"ttl":2800} | 規則配置,具體請參見IP 限速 config 參數說明 。 |
action | String | 是 | monitor | 規則動作,deny(攔截),monitor(觀察),captcha(滑塊,僅涉及 Web) 。 |
IP 限速 config 參數說明
參數 | 類型 | 必要 | 樣本值 | 描述 |
target | String | 是 | IP | 頻次控制的統計欄位,取值:IP。 |
subKey | String | 否 | 置空 | 統一欄位的子欄位,此處不涉及,置為空白值。 |
Interval | Integer | 是 | 20 | 統計時間長度,取值:5~1800,單位:秒。 |
threshold | Integer | 是 | 50 | 統計閾值,取值:2~50000,單位:次。 |
ttl | Integer | 是 | 2800 | 黑名單逾時時間,取值:60~86400,單位:秒。 |
IP 限速配置樣本:
[
{
"type":"custom_cc_ip",
"status":"on",
"config":{"interval":20,"target":"IP","threshold":50,"ttl":2800},
"action":"monitor"
},
{
"type":"custom_cc_ip",
"status":"on",
"config":{"interval":10,"target":"IP","threshold":30,"ttl":1800},
"action":"monitor"
}
]
規則分類九:裝置限速
參數 | 類型 | 必要 | 樣本值 | 描述 |
type | String | 是 | custom_cc_dev | 規則類型,取值:custom_cc_dev。 |
status | String | 是 | on | 規則開關,取值:on(開啟),off(關閉)。 |
config | CustomCcDev | 是 | {"interval":20,"target":"Header","subKey":"aliwaf_wxbb_umid","threshold":50,"ttl":2800} | 配置規則,具體請參見裝置限速 config 參數說明 。 |
action | String | 是 | monitor | 規則動作,deny(攔截),monitor(觀察)。 |
裝置限速 config 參數說明
參數 | 類型 | 必要 | 樣本值 | 描述 |
target | String | 是 | Header | 頻次控制的統計欄位,取值:Header。 |
subKey | String | 否 | aliwaf_wxbb_umid | 統一欄位的子欄位,取值:aliwaf_wxbb_umid。 |
Interval | Integer | 是 | 20 | 統計時間長度,取值:5~1800,單位:秒。 |
threshold | Integer | 是 | 50 | 統計閾值,取值:2~50000,單位:次。 |
ttl | Integer | 是 | 2800 | 黑名單逾時時間,取值:60~86400,單位:秒。 |
裝置限速配置樣本:
[
{
"type":"custom_cc_dev",
"status":"on",
"config":{"interval":20,"target":"Header","subKey":"aliwaf_wxbb_umid","threshold":50,"ttl":2800},
"action":"monitor"
},
{
"type":"custom_cc_dev",
"status":"on",
"config":{"interval":20,"target":"Header","subKey":"aliwaf_wxbb_umid","threshold":50,"ttl":2800},
"action":"deny"
}
]
規則分類十:自訂會話限速
參數 | 類型 | 必要 | 樣本值 | 描述 |
type | String | 是 | custom_cc | 規則類型,取值:custom_cc。 |
status | String | 是 | on | 規則開關,取值:on(開啟),off(關閉)。 |
config | CustomCcIp | 是 | {"interval":10,"target":"Query String Parameter","subKey":"arg","threshold":30,"ttl":1800} | 規則配置,具體請參見自訂會話限速 config 參數說明 。 |
action | String | 是 | monitor | 規則動作,deny(攔截),monitor(觀察),captcha(滑塊,僅涉及 Web) 。 |
自訂會話限速 config 參數說明
參數 | 類型 | 必要 | 樣本值 | 描述 |
target | String | 是 | Query String Parameter | 頻次控制的統計欄位,取值:Header(表示統計包含指定 Header 的請求的頻率),Query String Parameter(表示統計包含指定參數的請求的頻率),Cookie Name(表示統計包含指定 Cookie 的請求的頻率)和 Session(表示統計來自同一個會話發起請求的頻率)。 |
subKey | String | 否 | arg | 統一欄位的子欄位,使用者自訂。 |
Interval | Integer | 是 | 10 | 統計時間長度,取值:5~1800,單位:秒。 |
threshold | Integer | 是 | 30 | 統計閾值,取值:2~50000,單位:次。 |
ttl | Integer | 是 | 2800 | 黑名單逾時時間,取值:60~86400,單位:秒。 |
自訂會話限速配置樣本:
[
{
"type":"custom_cc",
"status":"on",
"config":{"interval":10,"target":"Query String Parameter","subKey":"arg","threshold":30,"ttl":1800},
"action":"deny"
},
{
"type":"custom_cc",
"status":"on",
"config":{"interval":10,"target":"Query String Parameter","subKey":"arg","threshold":30,"ttl":1800},
"action":"captcha"
}
]
規則分類十一:爬蟲威脅情報庫
參數 | 類型 | 必要 | 樣本值 | 描述 |
type | String | 是 | intelligence | 規則類型,取值:intelligence。 |
status | String | 是 | on | 規則開關,取值:on(開啟),off(關閉)。 |
config | Intelligence | 否 | 置空 | 規則配置,此處不涉及,置為空白值。 |
action | String | 是 | captcha | 規則動作,取值:monitor(觀察),captcha(滑塊校正)。 |
爬蟲威脅情報庫配置樣本:
[
{
"type":"intelligence",
"status":"on",
"config":{},
"action":"captcha"
}
]
規則分類十二:IDC 黑名單封鎖
參數 | 類型 | 必要 | 樣本值 | 描述 |
type | String | 是 | intelligence_idc | 規則類型,取值:intelligence_idc。 |
status | String | 是 | on | 規則開關,取值:on(開啟),off(關閉)。 |
config | IntelligenceIdc | 是 | {"name":"intelligence_idc_alibaba"} | 規則配置,取值請參見name 參數說明。 |
action | String | 是 | captcha | 規則動作,取值:deny(攔截),monitor(觀察),captcha(滑塊校正)。 |
name 參數說明
參數值 | 含義 |
intelligence_idc_alibaba | IDC IP 庫-阿里雲 |
intelligence_idc_tencent | IDC IP 庫-騰訊雲 |
intelligence_idc_mtyun | IDC IP 庫-美團雲 |
intelligence_idc_vnet | IDC IP 庫-世紀互聯 |
intelligence_idc_other | IDC IP 庫-其他 |
IDC 黑名單封鎖配置樣本:
[
{
"type":"intelligence_idc",
"status":"on",
"config":{"name":"intelligence_idc_alibaba"},
"action":"captcha"
},
{
"type":"intelligence_idc",
"status":"on",
"config":{"name":"intelligence_idc_tencent"},
"action":"captcha"
}
]
規則分類十三:偽造蜘蛛攔截
參數 | 類型 | 必要 | 樣本值 | 描述 |
type | String | 是 | intelligence_fake_crawler | 規則類型,取值:intelligence_fake_crawler。 |
status | String | 是 | on | 規則開關,取值:on(開啟),off(關閉)。 |
config | IntelligenceFakeCrawler | 否 | 置空 | 規則配置,此處不涉及,置為空白值。 |
action | String | 是 | deny | 規則動作,取值:deny(攔截)。 |
偽造蜘蛛攔截配置樣本:
[
{
"type": "intelligence_fake_crawler",
"status": "on",
"config":{},
"action": "deny"
}
]
規則分類十四:Bot 特徵識別
參數 | 類型 | 必要 | 樣本值 | 描述 |
type | String | 是 | app_sdk | 規則類型,取值:app_sdk。 |
status | String | 是 | on | 規則開關,取值:on(開啟)。 |
config | AppSdk | 是 | {"featureAbnormal":["simulator","proxy","root","debugged","hook","virtual","antiReplay","signInvalid"],"customSignStatus":"on","customSign":{"key":"header","value":"ua"}} | 規則配置,具體請參見Bot 特徵識別 config 參數說明 。 |
action | String | 是 | monitor | 規則動作,取值:deny(攔截),monitor(觀察)。 |
Bot 特徵識別 config 參數說明
參數 | 類型 | 必要 | 樣本值 | 描述 |
featureAbnormal | []String | 是 | simulator | signInvalid:APP 簽名異常。 |
customSignStatus | String | 否 | on | 自訂加簽欄位開關,取值:on(開啟),off(關閉)。 |
customSign | CustomSign | 否 | {"key":"header","value":"ua"} | 自訂加簽欄位,格式如下: |
Bot 特徵識別配置樣本:
[
{
"type": "app_sdk",
"status": "on",
"config": {"featureAbnormal":["simulator","proxy","root","debugged","hook","virtual","antiReplay","signInvalid"],"customSignStatus":"on","customSign":{"key":"header","value":"ua"}},
"action": "monitor"
}
]
規則分類十五:進階防護(二次打包檢測)
參數 | 類型 | 必要 | 樣本值 | 描述 |
type | String | 是 | app_package | 規則類型,取值:app_package。 |
status | String | 是 | on | 規則開關,取值:on(開啟)。 |
config | AppPackage | 否 | {"packageSigns":[{"name":"aaaaa","sign":"bbbb"},{"name":"cccc","sign":"dddd"}]} | 規則配置,具體請參見packageSigns 參數說明。 |
action | String | 是 | monitor | 規則動作,取值:deny(攔截),monitor(觀察)。 |
packageSigns 參數說明
參數 | 類型 | 必要 | 樣本值 | 描述 |
name | String | 是 | aaaaa | 指定合法包名。 |
sign | String | 否 | bbbb | 包簽名。 |
進階防護(二次打包檢測)配置樣本:
[
{
"type": "app_package",
"status": "on",
"config": {"packageSigns":[{"name":"aaaaa","sign":"bbbb"},{"name":"cccc","sign":"dddd"}]},
"action": "deny"
}
]
Bot 管理網頁/瀏覽器防護組合參數配置樣本
[
{
"type": "target_type",
"status": "on",
"config":
{
"target": "web"
},
"action": ""
},
{
"type": "web_sdk",
"status": "on",
"config":
{
"mode": "automatic",
"crossDomain": "example.com"
},
"action": ""
},
{
"type": "traffic_feature",
"status": "on",
"config":
{
"conditions":
[
{
"key": "Header",
"subKey": "User-Agent",
"opValue": "contain",
"values": "Chrome"
},
{
"key": "IP",
"subKey": "",
"opValue": "ip-contain",
"values": "192.168.0.1/24"
}
]
},
"action": ""
},
{
"type": "intelligence_crawler",
"status": "on",
"config":
{
"name": "intelligence_crawler_baidu"
},
"action": "bypass"
},
{
"type": "intelligence_crawler",
"status": "on",
"config":
{
"name": "intelligence_crawler_google"
},
"action": "bypass"
},
{
"type": "js",
"status": "on",
"config":
{},
"action": "js"
},
{
"type": "sigchl",
"status": "on",
"config":
{
"sigchl":
[
"sig",
"replay",
"driver"
]
},
"action": "sigchl"
},
{
"type": "algorithm",
"status": "on",
"config":
{},
"action": "captcha"
},
{
"type": "custom_cc_ip",
"status": "on",
"config":
{
"interval": 20,
"target": "IP",
"threshold": 50,
"ttl": 2800
},
"action": "monitor"
},
{
"type": "custom_cc_ip",
"status": "on",
"config":
{
"interval": 10,
"target": "IP",
"threshold": 30,
"ttl": 1800
},
"action": "monitor"
},
{
"type": "custom_cc",
"status": "on",
"config":
{
"interval": 10,
"target": "Query String Parameter",
"subKey": "arg",
"threshold": 30,
"ttl": 1800
},
"action": "deny"
},
{
"type": "custom_cc",
"status": "on",
"config":
{
"interval": 10,
"target": "Query String Parameter",
"subKey": "arg",
"threshold": 30,
"ttl": 1800
},
"action": "captcha"
},
{
"type": "intelligence",
"status": "on",
"config":
{},
"action": "captcha"
},
{
"type": "intelligence_idc",
"status": "on",
"config":
{
"name": "intelligence_idc_alibaba"
},
"action": "captcha"
},
{
"type": "intelligence_idc",
"status": "on",
"config":
{
"name": "intelligence_idc_tencent"
},
"action": "captcha"
},
{
"type": "intelligence_fake_crawler",
"status": "on",
"config":
{},
"action": "deny"
}
]
Bot 管理 APP 防護組合參數配置樣本
[
{
"type": "target_type",
"status": "on",
"config":
{
"target": "app"
},
"action": ""
},
{
"type": "traffic_feature",
"status": "on",
"config":
{
"conditions":
[
{
"key": "Header",
"subKey": "User-Agent",
"opValue": "contain",
"values": "Chrome"
},
{
"key": "IP",
"subKey": "",
"opValue": "ip-contain",
"values": "192.168.0.1/24"
}
]
},
"action": ""
},
{
"type": "custom_cc_ip",
"status": "on",
"config":
{
"interval": 20,
"target": "IP",
"threshold": 50,
"ttl": 2800
},
"action": "monitor"
},
{
"type": "custom_cc_ip",
"status": "on",
"config":
{
"interval": 10,
"target": "IP",
"threshold": 30,
"ttl": 1800
},
"action": "monitor"
},
{
"type": "custom_cc_dev",
"status": "on",
"config":
{
"interval": 20,
"target": "Header",
"subKey": "aliwaf_wxbb_umid",
"threshold": 50,
"ttl": 2800
},
"action": "monitor"
},
{
"type": "custom_cc_dev",
"status": "on",
"config":
{
"interval": 20,
"target": "Header",
"subKey": "aliwaf_wxbb_umid",
"threshold": 50,
"ttl": 2800
},
"action": "deny"
},
{
"type": "custom_cc",
"status": "on",
"config":
{
"interval": 10,
"target": "Query String Parameter",
"subKey": "arg",
"threshold": 30,
"ttl": 1800
},
"action": "monitor"
},
{
"type": "custom_cc",
"status": "on",
"config":
{
"interval": 10,
"target": "Query String Parameter",
"subKey": "arg",
"threshold": 30,
"ttl": 1800
},
"action": "deny"
},
{
"type": "app_sdk",
"status": "on",
"config":
{
"featureAbnormal":
[
"simulator",
"proxy",
"root",
"debugged",
"hook",
"virtual",
"antiReplay",
"signInvalid"
],
"customSignStatus": "on",
"customSign":
{
"key": "header",
"value": "ua"
}
},
"action": "monitor"
},
{
"type": "app_package",
"status": "on",
"config":
{
"packageSigns":
[
{
"name": "aaaaa",
"sign": "bbbb"
},
{
"name": "cccc",
"sign": "dddd"
}
]
},
"action": "deny"
}
]
防護情境 7:掃描防護(anti_scan)
規則模板
所有的規則參數都是以下四個,具體值請參見對應規則分類。
參數 | 類型 | 是否必選 | 描述 |
type | String | 是 | 規則類型:參見對應規則分類。 |
status | String | 否 | 規則狀態,取值:on(開啟),off(關閉)。 |
config | Type | 否 | 規則配置:參見對應規則分類。 |
action | String | 否 | 規則動作:參見對應規則分類。 |
規則分類一:高頻掃描封鎖
參數 | 類型 | 是否必選 | 樣本值 | 描述 |
type | String | 是 | high_frequency | 規則類型,取值:high_frequency 。 |
status | String | 是 | on | 規則開關,取值:on(開啟),off(關閉)。預設為 on。 |
config | HighFrequency | 否 | {"target":"IP","interval":20,"wafBlockThreshold":20,"ttl":1800,"distinctWafRuleThreshold":2} | 規則配置,具體請參見下方結構體字串。 |
action | String | 否 | deny | 規則動作,取值:deny(攔截),moniter(觀察)。 |
HighFrequency 說明
參數 | 類型 | 是否必選 | 樣本值 | 描述 |
target | String | 是 | IP | 頻次控制的統計欄位,取值:IP(IP 位址),Session(會話),Header(自訂 Header),Query String Parameter(自訂參數),Cookie Name(自訂 Cookie)。 |
subKey | String | 否 | yoursubKey | 統計欄位的子欄位,選擇自訂時有效。例如:如果 target 是自訂 Header 時,這個 subKey 就是 Header 的 key。 |
interval | Integer | 是 | 20 | 檢測時間範圍,取值:5~1800,單位:秒。 |
wafBlockThreshold | Integer | 是 | 20 | 基礎防護規則引發次數,取值:3~50000。 |
ttl | Integer | 是 | 1800 | 封鎖時間,取值:60~86400,單位:秒。 |
distinctWafRuleThreshold | Integer | 是 | 2 | 觸發規則數大於,取值:1~50。 |
[
{
"type":"high_frequency",
"status":"on",
"config":{"target":"IP","interval":20,"wafBlockThreshold":20,"ttl":1800,"distinctWafRuleThreshold":2},
"action":"deny"
}
]
規則分類二:目錄遍曆封鎖
參數 | 類型 | 是否必選 | 樣本值 | 描述 |
type | String | 是 | directory_traversal | 規則類型,取值:directory_traversal。 |
status | String | 是 | on | 規則開關,取值:on(開啟),off(關閉)。預設為 on。 |
config | DirectoryTraversal | 否 | {"target":"IP","interval":10,"threshold":50,"status":{"code":"404","ratio":70,"count":50},"ttl":1800} | 規則配置,具體請參見下方結構體字串。 |
action | String | 否 | deny | 規則動作,取值:deny(攔截),moniter(觀察)。 |
DirectoryTraversal 說明
參數 | 類型 | 是否必選 | 樣本值 | 描述 |
target | String | 是 | IP | 頻次控制的統計欄位,取值:IP(IP 位址),Session(會話),Header(自訂 Header),Query String Parameter(自訂參數),Cookie Name(自訂 Cookie)。 |
subKey | String | 否 | yoursubKey | 統計欄位的子欄位,選擇自訂時有效。例如:如果 target 是自訂 Header 時,這個 subKey 就是 Header 的 key。 |
interval | Integer | 是 | 10 | 檢測時間範圍,取值:5~1800,單位:秒。 |
threshold | Integer | 是 | 50 | 針對當前防護對象請求次數超過,取值:2~50000。 |
status | RateLimitStatus | 是 | {"code":"404","ratio":70,"count":50} | 響應碼。 |
ttl | Integer | 是 | 1800 | 封鎖時間,取值:60~86400,單位:秒。 |
RateLimitStatus 說明
參數 | 類型 | 是否必選 | 樣本值 | 描述 |
code | String | 是 | 樣本值 | HTTP 狀態代碼,取值:404。 |
ratio | Integer | 是 | 樣本值 | 404 響應碼佔比,取值:1~100。 |
count | Integer | 是 | 樣本值 | 不存在的目錄數量,取值:2~50000。 |
[
{
"type":"directory_traversal",
"status":"on",
"config":{"target":"IP","interval":10,"threshold":50,"status":{"code":"404","ratio":70,"count":50},"ttl":1800},
"action":"deny"
}
]
規則分類三:掃描工具封鎖
參數 | 類型 | 是否必選 | 樣本值 | 描述 |
type | String | 是 | scan_tools | 規則類型,取值:scan_tools。 |
status | String | 是 | on | 規則開關,取值:on(開啟),off(關閉)。預設為 on。 |
config | ScanTools | 否 | 空 | 規則配置,這裡不填。 |
action | String | 否 | deny | 規則動作,取值:deny(攔截),moniter(觀察)。 |
[
{
"type":"scan_tools",
"status":"on",
"config":{},
"action":"deny"
}
]
最終組合參數
[
{
"type":"high_frequency",
"status":"on",
"config":{"target":"IP","interval":20,"wafBlockThreshold":20,"ttl":1800,"distinctWafRuleThreshold":2},
"action":"deny"
},
{
"type":"directory_traversal",
"status":"on",
"config":{"target":"IP","interval":10,"threshold":50,"status":{"code":"404","ratio":70,"count":50},"ttl":1800},
"action":"deny"
},
{
"type":"scan_tools",
"status":"on",
"config":{},
"action":"deny"
}
]
返回參數
|
名稱 |
類型 |
描述 |
樣本值 |
|
object |
|||
| RequestId |
string |
請求 ID。 |
CB1A380B-09F0-41BB-280B-72F8FD6DA2FE |
| RuleIds |
object |
||
| RuleId |
array |
||
|
string |
建立的規則 ID 列表。 |
100001,200002 |
樣本
正常返回樣本
JSON格式
{
"RequestId": "CB1A380B-09F0-41BB-280B-72F8FD6DA2FE",
"RuleIds": {
"RuleId": [
"100001,200002"
]
}
}
錯誤碼
|
HTTP status code |
錯誤碼 |
錯誤資訊 |
描述 |
|---|---|---|---|
| 400 | InvalidParameter | The specified parameter is invalid. | 參數錯誤 |
| 400 | Policy.NotExist | The specified policy does not exist. | 指定的防護策略不存在。 |
| 400 | RuleConfigs.Malformed | The specified RuleConfigs format is invalid. | 指定的參數RuleConfigs格式錯誤。 |
| 400 | RuleName.AlreadyExists | Rule name already exists in specified policy. | 規則名稱在指定的策略中已存在。 |
| 400 | Rule.QuantityOverflow | Rules are overflowed quantity in specified policy. | 規則在指定的策略中超出配額。 |
| 500 | InternalError | An internal error occurred; please try again later. | 內部錯誤,請重試,如果多次重試報錯請提交工單。 |
| 403 | %s.NotSupport | The specified resource type %s is not supported. | 不支援指定的資源類型。如需使用該類型資源,請與我們聯絡。 |
| 403 | %s.OverQuota | The quantity of %s exceeds the quota. | 該資源的數量超出了配額所規定的範圍,如需申請更多的額度,請與我們聯絡。 |
訪問錯誤中心查看更多錯誤碼。
變更歷史
更多資訊,參考變更詳情。