收集安全 Web 代理日志

支持的语言:

本文档介绍了如何使用 Cloud Storage 将安全 Web 代理导出并注入到 Google Security Operations 中。解析器从 JSON 日志中提取字段,并将其转换为统一数据模型 (UDM)。它会初始化 UDM 字段、解析 JSON 载荷、提取网络信息、安全详细信息、资源属性,并根据正文和目标信息的存在情况设置事件类型。

准备工作

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

  • Google SecOps 实例。
  • 安全 Web 代理在您的 Google Cloud 环境中处于活动状态并已配置。
  • 对 Google Cloud 的高级访问权限,以及访问安全 Web 代理日志的相应权限。

创建 Cloud Storage 存储桶

  1. 登录 Google Cloud 控制台
  2. 前往 Cloud Storage 存储分区页面。

    进入“存储桶”

  3. 点击创建

  4. 创建存储桶页面上,输入您的存储桶信息。完成以下每一步后,点击继续以继续执行后续步骤:

    1. 开始使用部分中,执行以下操作:

      1. 输入符合存储桶名称要求的唯一名称,例如 gcp-swp-logs
      2. 如需启用分层命名空间,请点击展开箭头以展开优化文件导向型和数据密集型工作负载部分,然后选择在此存储桶上启用分层命名空间

      3. 如需添加存储桶标签,请点击展开箭头以展开标签部分。

      4. 点击添加标签,然后为标签指定键和值。

    2. 选择数据存储位置部分中,执行以下操作:

      1. 选择位置类型
      2. 使用位置类型菜单选择一个位置,用于永久存储存储桶中的对象数据。

      3. 如需设置跨存储桶复制,请展开设置跨存储桶复制部分。

    3. 为数据选择一个存储类别部分中,为存储桶选择默认存储类别,或者选择 Autoclass 对存储桶数据进行自动存储类别管理。

    4. 选择如何控制对对象的访问权限部分中,选择强制执行禁止公开访问,然后为存储桶对象选择访问权限控制模型

    5. 选择如何保护对象数据部分中,执行以下操作:

      1. 数据保护下,选择您要为存储桶设置的任何选项。
      2. 如需选择对象数据的加密方式,请点击标有数据加密的展开箭头,然后选择数据加密方法
  5. 点击创建

配置安全 Web 代理日志导出

  1. 登录 Google Cloud 控制台
  2. 前往日志记录 > 日志路由器
  3. 点击创建接收器
  4. 提供以下配置参数:

    • 接收器名称:输入一个有意义的名称,例如 SWP-Export-Sink
    • 接收器目标位置:选择 Cloud Storage 存储空间,然后输入存储桶的 URI,例如 gs://gcp-swp-logs
    • 日志过滤条件
    logName="projects/<your-project-id>/logs/networkservices.googleapis.com/gateway_requests"
    
  5. 点击创建

配置 Cloud Storage 权限

  1. 前往 IAM 和管理> IAM
  2. 找到 Cloud Logging 服务账号。
  3. 授予对相应存储桶的 roles/storage.admin

设置 Feed

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

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

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

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

  1. 依次前往 SIEM 设置 > Feed
  2. 点击添加新 Feed
  3. 在下一页上,点击配置单个 Feed
  4. Feed name(Feed 名称)字段中,输入 Feed 的名称,例如 Google Cloud SWP Logs
  5. 选择 Google Cloud Storage 作为来源类型
  6. 选择 GCP Secure Web Proxy 作为日志类型
  7. 点击Chronicle 服务账号字段旁边的获取服务账号
  8. 点击下一步
  9. 为以下输入参数指定值:

    • 存储分区 URI:Cloud Storage 存储桶网址;例如 gs://gcp-swp-logs
    • URI Is A:选择目录(包括子目录)
    • 来源删除选项:根据您的偏好设置选择删除选项。

  10. 点击下一步

  11. 最终确定界面中查看新的 Feed 配置,然后点击提交

设置来自内容中心的 Feed

为以下字段指定值:

  • 存储分区 URI:Cloud Storage 存储桶网址;例如 gs://gcp-swp-logs
  • URI Is A:选择目录(包括子目录)
  • 来源删除选项:根据您的偏好设置选择删除选项。

高级选项

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

UDM 映射表

日志字段 UDM 映射 逻辑
httpRequest.latency additional.fields[].keyHTTPRequest Latency
additional.fields[].value.string_value0.124462s
直接从原始日志字段映射。
httpRequest.protocol network.application_protocolHTTP
network.application_protocol_version2
协议和版本使用 grok 模式从 httpRequest.protocol 字段中提取。
httpRequest.remoteIp target.asset.ip1.1.0.1
target.ip1.1.0.1
IP 地址使用 Grok 模式从 httpRequest.remoteIp 字段中提取。
httpRequest.requestMethod network.http.methodGET 直接从原始日志字段映射。
httpRequest.requestSize network.sent_bytes:144 直接从原始日志字段映射并转换为整数。
httpRequest.requestUrl target.urlhttps://github.com/tempuslabs/tempusutils/info/refs?service=git-upload-pack 直接从原始日志字段映射。
httpRequest.responseSize network.received_bytes:225 直接从原始日志字段映射并转换为整数。
httpRequest.serverIp principal.asset.ip1.8.1.4
principal.ip1.8.1.4
IP 地址使用 Grok 模式从 httpRequest.serverIp 字段中提取。
httpRequest.status network.http.response_code:401 直接从原始日志字段映射并转换为整数。
httpRequest.userAgent network.http.user_agent: git/2.34.1
network.http.parsed_user_agent: {
family: USER_DEFINED,
device: git,
device_version: 2.34.1
}
直接从原始日志字段映射。parsed_user_agent 字段是通过解析 httpRequest.userAgent 字段派生出来的。
insertId metadata.product_log_id1yh8wczer5o8n 直接从原始日志字段映射。
jsonPayload.@type additional.fields[].keyLog Type
additional.fields[].value.string_valuetype.googleapis.com/google.cloud.loadbalancing.type.LoadBalancerLogEntry
直接从原始日志字段映射。
jsonPayload.enforcedGatewaySecurityPolicy.hostname target.asset.hostnamegithub.com
target.hostnamegithub.com
直接从原始日志字段映射。
jsonPayload.enforcedGatewaySecurityPolicy.matchedRules[].action security_result.actionALLOW
security_result.action_detailsALLOWED
security_result.action 是根据 jsonPayload.enforcedGatewaySecurityPolicy.matchedRules[].action 的值派生的。如果操作为 ALLOWED,则 UDM 字段设置为 ALLOW。如果操作为 DENIED,则 UDM 字段设置为 BLOCK
jsonPayload.enforcedGatewaySecurityPolicy.matchedRules[].name security_result.rule_nameprojects/671807354785/locations/us-central1/gatewaySecurityPolicies/github-access-gateway-security-policy-5cec30cd/rules/github-access-gateway-security-policy-rule-5cec30cd 直接从原始日志字段映射。
jsonPayload.enforcedGatewaySecurityPolicy.requestWasTlsIntercepted security_result.detection_fields[].keyrequestWasTlsIntercepted
security_result.detection_fields[].valuetrue
直接从原始日志字段映射。
logName additional.fields[].keyLog Name
additional.fields[].value.string_valueprojects/rws-w6uza3pn5jzzh6z3hc3d/logs/networkservices.googleapis.com%2Fgateway_requests
直接从原始日志字段映射。
receiveTimestamp metadata.collected_timestamp: {
seconds: 1710189647,
nanos: 661101224
}
使用 RFC 3339 日期格式从原始日志字段解析。
resource.labels.gateway_name security_result.detection_fields[].keygateway-name
security_result.detection_fields[].valuegithub-access-gateway-5cec30cd
直接从原始日志字段映射。
resource.labels.gateway_type security_result.detection_fields[].keygateway-type
security_result.detection_fields[].valueSECURE_WEB_GATEWAY
直接从原始日志字段映射。
resource.labels.location target.resource.attribute.cloud.availability_zoneus-central1 直接从原始日志字段映射。
resource.labels.network_name target.resource.attribute.labels[].keyrc_network_name
target.resource.attribute.labels[].valueprojects/rws-w6uza3pn5jzzh6z3hc3d/global/networks/rws-tr-pilot-workspace
直接从原始日志字段映射。
resource.type target.resource.attribute.labels[].keyResource Type
target.resource.attribute.labels[].valuenetworkservices.googleapis.com/Gateway
直接从原始日志字段映射。
severity security_result.severityMEDIUM 从原始日志字段映射而来。该值会转换为 UDM 严重程度。在这种情况下,WARNING 会映射到 MEDIUM
timestamp metadata.event_timestamp: {
seconds: 1710189639,
nanos: 952848000
}
使用 RFC 3339 日期格式从原始日志字段解析。
(解析器逻辑) metadata.event_typeNETWORK_HTTP 由解析器逻辑根据 has_principalhas_target 的存在情况以及与 http 相匹配的协议来确定。
(解析器逻辑) metadata.log_typeGCP_SWP 基于产品的硬编码值。

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