收集 Auth0 日志

支持的语言:

概览

此解析器可从 JSON 格式的消息中提取 Auth0 日志事件。它会初始化 UDM 字段、解析 JSON 载荷、将相关字段映射到 UDM 架构,并根据 type 字段对事件进行分类,设置适当的安全操作和事件类型。

准备工作

确保您满足以下前提条件:

  • Google SecOps 实例。
  • 具有必要权限的 Auth0 账号。

设置 Feed

您可以通过两种不同的入口点在 Google SecOps 平台中设置 Feed:

  • SIEM 设置 > Feed
  • 内容中心 > 内容包

通过“SIEM 设置”>“Feed”设置 Feed

如需配置 Feed,请按以下步骤操作:

  1. 依次前往 SIEM 设置 > Feed
  2. 点击添加新 Feed
  3. 在下一页上,点击配置单个 Feed
  4. Feed name(Feed 名称)字段中,输入 Feed 的名称(例如 Auth0 Logs)。
  5. 选择 Webhook 作为来源类型
  6. 选择 AUTH_ZERO 作为日志类型
  7. 点击下一步
  8. 可选:为以下输入参数指定值:
    • 拆分分隔符:用于分隔日志行的分隔符,例如 \n
    • 资源命名空间资源命名空间
    • 注入标签:应用于此 Feed 中事件的标签。
  9. 点击下一步
  10. 最终确定界面中检查 Feed 配置,然后点击提交
  11. 点击生成密钥,生成用于对此 Feed 进行身份验证的密钥。
  12. 复制并存储密钥。您将无法再次查看此密钥。如有需要,您可以重新生成新的 Secret 密钥,但此操作会使之前的 Secret 密钥失效。
  13. 详情标签页中,从端点信息字段复制 Feed 端点网址。您需要在客户端应用中指定此端点网址。
  14. 点击完成

设置来自内容中心的 Feed

为以下字段指定值:

  • 拆分分隔符:用于分隔日志行的分隔符,例如 \n

高级选项

  • Feed 名称:用于标识 Feed 的预填充值。
  • 来源类型:用于将日志收集到 Google SecOps 中的方法。
  • 资源命名空间:与 Feed 关联的命名空间。
  • 提取标签:应用于相应 Feed 中所有事件的标签。

  • 点击生成密钥,生成用于对此 Feed 进行身份验证的密钥。

  • 复制并存储密钥。您将无法再次查看此密钥。如有需要,您可以重新生成新的 Secret 密钥,但此操作会使之前的 Secret 密钥失效。

  • 详情标签页中,从端点信息字段复制 Feed 端点网址。您需要在客户端应用中指定此端点网址。

为 Webhook Feed 创建 API 密钥

  1. 依次前往 Google Cloud 控制台 > 凭据

    转到“凭证”页面

  2. 点击创建凭据,然后选择 API 密钥

  3. 将 API 密钥访问权限限制为 Chronicle API

指定端点网址

  1. 在客户端应用中,指定 webhook Feed 中提供的 HTTPS 端点网址。
  2. 通过在自定义标头中指定 API 密钥和密钥来启用身份验证,格式如下:

    X-goog-api-key = API_KEY
    X-Webhook-Access-Key = SECRET
    

    建议:将 API 密钥指定为标头,而不是在网址中指定。如果您的 Webhook 客户端不支持自定义标头,您可以使用以下格式的查询参数指定 API 密钥和密钥:

    ENDPOINT_URL?key=API_KEY&secret=SECRET
    

替换以下内容:

  • ENDPOINT_URL:Feed 端点网址。
  • API_KEY:用于向 Google Security Operations 进行身份验证的 API 密钥。
  • SECRET:您生成的用于验证 Feed 的密钥。

为 Google SecOps 配置 Auth0 网络钩子

  1. 访问 Auth0 信息中心。
  2. 依次前往监控 > 数据流
  3. 点击创建日志流
  4. 点击自定义 Webhook 按钮,然后为其指定一个您选择的名称。例如:Google SecOps Webhook
  5. 配置以下内容:
    • Payload 网址:输入 Google SecOps API 端点网址。
    • Content-Type:将 Content-Type 标头设置为 application/json。此参数用于告知 Google SecOps 所发送数据的格式。
    • 可选:授权令牌:配置密钥以提高安全性。此令牌将用于验证 Webhook 请求的真实性。

自定义载荷:您可以通过修改事件类别来自定义发送到 Google SecOps 的载荷。这样一来,您就可以从 Auth0 事件中选择特定的数据点,并根据 Google SecOps 的需要设置其格式。如需详细了解可用的上下文变量和脚本选项,请参阅 Auth0 文档。确保最终载荷符合预期的 Google SecOps UDM 格式。

  1. 点击保存以创建 Webhook。
  2. 触发与钩子关联的事件(例如,注册新用户、登录)。
  3. 通过检查 Google SecOps 控制台中的 Feed,验证日志是否已发送到 Google SecOps。

UDM 映射表

日志字段 UDM 映射 逻辑
client_id principal.asset.product_object_id 直接从 client_id 字段映射。
client_name principal.hostname 直接从 client_name 字段映射。
connection security_result.description 直接从 connection 字段映射。
connection_id security_result.rule_id 直接从 connection_id 字段映射。
date metadata.event_timestamp 使用 ISO8601 格式从 date 字段解析。
description metadata.description 直接从 description 字段映射。
details.error security_result.detection_fields details.error 字段映射。键为“Error”。
details.error.oauthError security_result.detection_fields details.error.oauthError 字段映射。键为“oauthError”。
details.error.type security_result.detection_fields details.error.type 字段映射。键为“oauth_error_type”。
details.ipOnAllowlist security_result.detection_fields details.ipOnAllowlist 字段映射。键为“ipOnAllowlist”。
details.link target.url 如果存在,则直接从 details.link 字段映射,否则从其他字段派生(见下文)。
details.request.auth.strategy security_result.detection_fields details.request.auth.strategy 字段映射。键为“strategy”。
details.request.body.app_metadata.blockedReason security_result.detection_fields details.request.body.app_metadata.blockedReason 字段映射。键为“blockedReason”。
details.request.body.app_metadata.customer_id target.user.product_object_id 直接从 details.request.body.app_metadata.customer_id 字段映射。
details.request.body.app_metadata.migrated security_result.detection_fields details.request.body.app_metadata.migrated 字段映射。键为“migrated”。
details.request.channel security_result.detection_fields details.request.channel 字段映射。键为“channel”。
details.request.method network.http.method 直接从 details.request.method 字段映射,并转换为大写。
details.request.path target.url 如果不存在 details.link,则直接从 details.request.path 字段映射;否则,从其他字段派生(见下文)。
details.response.body.email target.user.email_addresses 直接从 details.response.body.email 字段映射。
details.response.body.email_verified security_result.detection_fields details.response.body.email_verified 字段映射。键为“email_verified”。
details.response.body.nickname target.user.user_display_name 直接从 details.response.body.nickname 字段映射。
details.response.body.user_id target.user.userid 直接从 details.response.body.user_id 字段映射。
details.response.statusCode network.http.response_code 直接从 details.response.statusCode 字段映射,并转换为整数。
details.return_to target.url 如果不存在 details.linkdetails.request.path,则直接从 details.return_to 字段映射;否则,从其他字段派生(见下文)。
details.session_id network.session_id 直接从 details.session_id 字段映射。
details.stats.loginsCount additional.fields details.stats.loginsCount 字段映射。键为“loginsCount”。
details.requiresVerification security_result.detection_fields details.requiresVerification 字段映射。键为“requiresVerification”。
details.to target.user.email_addresses 直接从 details.to 字段映射。
hostname target.hostname 直接从 hostname 字段映射。
ip principal.ip 直接从 ip 字段映射。
js_data.audience target.url 如果不存在 details.linkdetails.request.pathdetails.return_to,则直接从 js_data.audience 字段映射。
js_data.details.body.email_verified security_result.detection_fields js_data.details.body.email_verified 字段映射。键为“email_verified”。
js_data.details.body.is_signup security_result.detection_fields js_data.details.body.is_signup 字段映射。键为“is_signup”。
js_data.details.body.transaction.redirect_uri target.url 如果不存在 details.linkdetails.request.pathdetails.return_tojs_data.audience,则直接从 js_data.details.body.transaction.redirect_uri 字段映射。
js_data.scope security_result.detection_fields js_data.scope 字段映射。键为“scope”。
js_data.tracking_id security_result.detection_fields js_data.tracking_id 字段映射。键为“tracking_id”。
log_id metadata.product_log_id 直接从 log_id 字段映射。
metadata.log_type metadata.log_type 直接从 log_type 字段映射。
metadata.product_name metadata.product_name 设置为“AUTH_ZERO”。
metadata.vendor_name metadata.vendor_name 设置为“AUTH_ZERO”。
metadata.product_event_type metadata.product_event_type 直接从 type 字段映射。
network.http.parsed_user_agent network.http.parsed_user_agent user_agent 字段解析。
network.http.user_agent network.http.user_agent 直接从 user_agent 字段映射。
security_result.action security_result.action type 字段(ALLOW 或 BLOCK)确定。如需了解具体映射,请参阅解析器代码。
strategy security_result.detection_fields strategy 字段映射。键为“strategy”。
strategy_type security_result.detection_fields strategy_type 字段映射。键为“strategy_type”。
target.user.email_addresses target.user.email_addresses 如果 user_name 字段是电子邮件地址,则直接从该字段映射;否则从其他字段派生(见上文)。
target.user.userid target.user.userid 直接从 user_id 字段映射,如果不存在 user_id,则从 details.response.body.user_iduser_name 映射。
user_agent network.http.user_agent 直接从 user_agent 字段映射。
user_id target.user.userid 直接从 user_id 字段映射。
user_name target.user.email_addresses 直接从 user_name 字段映射。如果 security_result.action 为“ALLOW”且 type 为“slo”“sapi”“s”“ss”或“ssa”,则设置为“MACHINE”。如果 extensions.auth.type 为“MACHINE”且 type 为“slo”,则设置为“OTP”。由包括 typeclient_nameiphostnamehas_user 在内的多个字段共同决定。如需了解具体映射,请参阅解析器代码。

需要更多帮助?从社区成员和 Google SecOps 专业人士那里获得解答。