检测 ID (Detection IDs) 是检测与人类流量无重叠的可预测 bot 行为的静态规则。每个 ID 都映射到特定的检测方法,例如启发式算法、已验证的 bot 检测或异常检测。例如,检测 ID 可以识别客户端发送标头的顺序何时与其声称使用的浏览器所使用的顺序不同。
如果您对我们的某项启发式算法有疑问,检测 ID 允许您使用客户可配置的启发式算法来决定在您的区域上执行哪些启发式算法。对于通过 Cloudflare 启发式引擎检测到的不同 bot,您可以选择独特的操作。您可以阻止、允许或向特定 bot 提供备用内容,以满足您站点流量的独特需求。
您可以在以下工具中使用 cf.bot_management.detection_ids 字段:
- 自定义规则 (Custom rules)
- 高级速率限制
- 转换规则 (Transform Rules)
- Workers(作为
request.cf.botManagement.detectionIds)
Bot 检测 ID 和标签也可以在 Bot 分析 (Bot Analytics) 和 安全分析 (Security Analytics) 中使用。
检测标签是指在 Cloudflare 识别出 bot 指纹时与检测 ID 相关联的类别。例如,如果检测标签是 go,这意味着 Cloudflare 观察到了来自该检测 ID 且属于 Go 编程语言 bot 的流量。
-
在 Cloudflare 仪表板中,前往 Security Analytics(安全分析) 页面。
Go to Analytics ↗ -
应用过滤器并选择 Create custom security rule(创建自定义安全规则),以根据您的过滤器创建自定义规则。
或者,如果您已经创建了自定义规则,可以前往 Security rules(安全规则) 中的现有规则,并根据您的过滤器编辑表达式。
Go to Security rules ↗ -
在规则表达式中使用
cf.bot_management.detection_ids字段。 -
选择 Deploy(部署)。
- 登录到 Cloudflare 仪表板 ↗,然后选择您的账户和域。
- 前往 Security(安全) > Bots,应用过滤器并选择 Create custom rule(创建自定义规则),以根据这些过滤器创建自定义规则。或者,如果您已经创建了自定义规则,前往 Security(安全) > WAF > Custom rules(自定义规则) 并编辑现有自定义规则的表达式。
- 在规则表达式中使用
cf.bot_management.detection_ids字段。 - 选择 Save(保存)。
any(cf.bot_management.detection_ids[*] eq 3355446)
and not cf.bot_management.verified_bot
and http.request.uri.path eq "/login"
and http.request.method eq "POST"cf.bot_management.score lt 30
and not cf.bot_management.verified_bot
and http.request.uri.path eq "/login"
and http.request.method eq "POST"
and not any(cf.bot_management.detection_ids[*] in {3355446 12577893})您可以创建或编辑现有的 Logpush 作业,以包含新的 Bot 检测 ID 字段,该字段将为触发了启发式匹配的每个请求提供一个 ID 数组。BotDetectionIDs 字段作为 HTTP 请求数据集的一部分提供,您可以通过 Logpush API 或在 Cloudflare 仪表板上将其添加到新建或现有的作业中。这是发现检测 ID 的主要方法。
-
在 Cloudflare 仪表板中,前往 Logpush(日志推送) 页面。
Go to Logpush ↗ -
选择 Create a Logpush job(创建 Logpush 作业)。
-
选择并输入目标位置信息。
-
选择 HTTP requests(HTTP 请求) 作为数据集。
-
在常规数据字段类别下选择 BotDetectionIDs(Bot 检测 ID)。
-
证明所有权。
-
选择 Save(保存)。
通过将 BotDetectionIDs 添加到 output_options: 参数来更新您的 logpush 作业。
检测 ID 适用于 Enterprise Bot Management 客户。