跳转到内容
搜索文档

Bot Management (Bot 管理)

最后更新 查看 MarkdownAgent 设置

Enterprise 版的 Bot Management 是一个付费附加服务,可为您的域名提供先进的 bot 防护。客户可以识别自动化流量、采取适当行动,并在仪表板中查看详细的分析数据。

该企业版产品通过以下方式为客户提供最大的灵活性:

  • 为每个请求生成 1-99 的 bot 分数 (bot score)。低于 30 的分数通常与 bot 流量相关。这允许您编写针对性的规则,而不是对所有检测到的 bot 应用一揽子操作。
  • 允许客户使用 WAF 自定义规则Workers 针对该分数采取行动。例如,您可以在登录页面上质询低分请求,而在您的公开博客上允许它们通过。
  • 允许客户在 Bot 分析或日志中查看此分数,以便您能够分析 bot 流量模式并随着时间的推移调整规则。

启用 Enterprise 版 Bot Management

已购买该附加服务的 Enterprise 区域会自动启用 Bot Management。

  1. 在 Cloudflare 仪表板中,前往 Security settings(安全设置) 页面。

    Go to Settings ↗
  2. Bot traffic(Bot 流量) 过滤。

  3. 前往 Bot Management(Bot 管理)

  4. 开启 Bot Management(Bot 管理)

  5. 选择相关编辑图标,选择您的域名应该如何响应各种类型的流量。

要在未购买 Bot Management 附加服务的 Enterprise 区域上启用 Bot Management 试用:

  1. 登录到您的 Cloudflare 仪表板,然后选择您的账户和域。
  2. 前往 Security(安全) > Bots
  3. 选择 Add Bot Management(添加 Bot Management)

设置

Cloudflare 建议您部署以下基本设置,并根据您区域中的流量进行自定义。

启用最新的机器学习版本

Cloudflare 鼓励企业版客户启用机器学习模型的自动更新,以便在最新 Bot 检测模型发布时及时获取。

要启用自动更新:

  1. 在 Cloudflare 仪表板中,前往 Security Settings(安全设置) 页面。

    Go to Settings ↗
  2. Bot traffic 进行筛选。

  3. 前往 Bot Management(Bot 管理)

  4. Configurations 下,选择 Auto-updates to the Machine Learning Model(机器学习模型自动更新) 的编辑图标并将其开启。

  1. 登录 Cloudflare 仪表板,选择您的账户和域名。
  2. 前往 Security(安全性) > Bots
  3. 选择 Configure Bot Management(配置 Bot Management)
  4. 启用 Auto-updates to the Machine Learning Model(机器学习模型自动更新)

阻止 AI Bot

请参阅 阻止 AI Bot

部署自定义规则模板

您在前面的步骤中配置的 Definitely Automated(确定为自动化)Likely Automated(可能为自动化) 开关已经提供了针对自动化流量的基线防护。

如果您需要额外的控制(例如特定路径的保护、自定义分数阈值,或者将 bot 分数与其他字段结合使用),Cloudflare 提供了规则模板以帮助您快速入门。

这些模板使用 wirefilter 表达式语法。在这些表达式中,eq 表示等于,le 表示小于或等于,ge 表示大于或等于,not 排除匹配的流量。

  • 确定为 Bot (Definite Bots) 模板:针对恶意 bot 流量,同时忽略已验证的 bot 以及传输静态内容的路由。

    (cf.bot_management.score eq 1 and not cf.bot_management.verified_bot and not cf.bot_management.static_resource)
  • 可能为 Bot (Likely Bots) 模板:针对可能为恶意 bot 的流量,同时忽略已验证的 bot 和具有静态内容的路由。它可能包含少量非 bot 流量。

    (cf.bot_management.score ge 2 and cf.bot_management.score le 29 and not cf.bot_management.verified_bot and not cf.bot_management.static_resource)
  • (可选)JavaScript 检测模板 (JavaScript verified URLs):您必须先从安全设置中启用 JavaScript 检测,然后设置托管质询。确保添加了方法和 URI 路径。JavaScript 检测提高了对于应仅期望支持 JavaScript 客户端的 URL 的安全性。

    (not cf.bot_management.js_detection.passed and http.request.method eq "" and http.request.uri.path in {""})

这篇文档对您有帮助吗?