收集 AWS S3 服务器访问日志

支持的平台:

本文档介绍了如何通过设置 Google 安全运营 Feed 来收集 AWS S3 服务器访问日志。解析器使用 Grok 模式提取字段、处理潜在的 JSON 输入,并将提取的字段映射到 UDM。它会根据特定字段的存在性和值执行数据转换、类型转换和条件逻辑,以确保准确的 UDM 表示法。

准备工作

  • 确保您拥有 Google SecOps 实例。
  • 确保您拥有对 AWS 的特权访问权限。

配置 AWS S3 服务器访问日志记录

Google SecOps 支持通过 Amazon SQS 使用 Amazon S3 收集日志。

  1. 登录 AWS 管理控制台。
  2. 访问 Amazon S3 控制台。
  3. 依次前往 Amazon S3 > 存储分区
  4. 选择现有存储分区或创建新存储分区。
  5. 点击属性
  6. 服务器访问日志记录部分,点击修改
  7. 选择启用
  8. 目标存储分区字段中,输入要将日志记录对象发送到的新的存储分区的名称,或选择现有存储分区作为目标。
  1. 点击保存更改
  2. 如需为 S3 存储分区创建 SQS 队列,请使用 S3 存储空间配置 Amazon SQS 实例。如需了解详情,请参阅配置用于接收通知的存储分区(SNS 主题或 SQS 队列)

根据服务和区域,参阅以下 AWS 文档确定连接端点: * 如需了解任何日志记录来源,请参阅 AWS Identity and Access Management 端点和配额。 * 如需了解 S3 日志记录源,请参阅 Amazon Simple Storage Service 端点和配额。 * 如需了解 SQS 日志记录来源,请参阅 Amazon Simple Queue Service 端点和配额

在 Google SecOps 中配置 Feed 以提取 AWS S3 服务器访问日志

  1. 在 Google SecOps 菜单中,依次选择设置 > Feed > 添加新 Feed
  2. 来源类型列表中,选择 Amazon S3Amazon SQS
  3. 日志类型列表中,选择 AWS S3 服务器访问
  4. 点击下一步
  5. Google SecOps 支持使用访问密钥 ID 和 Secret 方法收集日志。如需创建访问密钥 ID 和密钥,请参阅使用 AWS 配置工具身份验证
  6. 根据您创建的 AWS S3 服务器访问权限配置,为输入参数指定值:
    • 如果使用 Amazon S3,请为以下字段指定值:
      • 区域
      • S3 URI
      • URI 是
      • 来源删除选项
      • 访问密钥 ID
      • 私有访问密钥
    • 如果使用 Amazon SQS,请为以下字段指定值:
      • 区域
      • 队列名称
      • 账号
      • 队列访问密钥 ID
      • 队列私有访问密钥
      • 来源删除选项
  7. 点击下一步,然后点击提交

UDM 映射表

日志字段 UDM 映射 逻辑
aclRequired target.resource.attribute.labels.key:“aclRequired”
target.resource.attribute.labels.valueaclRequired 的值
直接从原始日志字段 aclRequired 映射而来。
authenticationtype extensions.auth.auth_details 直接从原始日志字段 authenticationtype 映射而来。
bucket target.resource.name 直接从原始日志字段 bucket 映射而来。
bucket target.resource.resource_type:“STORAGE_BUCKET” 如果存在 bucket 字段,解析器会将 resource_type 设置为“STORAGE_BUCKET”。
bucketowner target.resource.product_object_id 直接从原始日志字段 bucketowner 映射而来。
bytes_sent network.sent_bytes 直接从原始日志字段 bytes_sent 映射而来,前提是将其转换为无符号整数并将“-”替换为“0”。
ciphersuite network.application_protocol:“HTTPS” 如果存在 ciphersuite 字段,解析器会将 application_protocol 设置为“HTTPS”。
ciphersuite network.tls.cipher 直接从原始日志字段 ciphersuite 映射而来。
errorcode security_result.action_details 直接从原始日志字段 errorcode 映射而来。
errorcode security_result.action:“BLOCK” 如果 errorcode 字段包含“AccessDenied”(不区分大小写),则解析器会将 action 设置为“BLOCK”。
hostheader target.hostname 从原始日志字段 hostheader 中提取,可能会移除端口号。
hostheader target.port 从原始日志字段 hostheader 中提取(如果存在端口号)。
hostid target.resource.attribute.labels.key:“S3 扩展请求 ID”
target.resource.attribute.labels.valuehostid 的值
直接从原始日志字段 hostid 映射而来。
http_capture network.http.method HTTP 方法会从 http_capture 字段中提取。
http_capture network.http.version HTTP 版本会从 http_capture 字段中提取。
http_capture target.url 目标网址使用 hostheaderhttp_request_uri(从 http_capture 中提取)构建而成,并根据 ciphersuite 的存在情况带有“http://”或“https://”前缀。
httpstatus network.http.response_code 直接从原始日志字段 httpstatus 映射而来,并将其转换为整数。
object_version_id target.resource.product_object_id 直接从原始日志字段 object_version_id 映射而来。
objectsize target.file.size 直接从原始日志字段 objectsize 映射而来,前提是将其转换为无符号整数并将“-”替换为“0”。
operation metadata.product_event_type 直接从原始日志字段 operation 映射而来。
referrer network.http.referral_url 从移除引号后的原始日志字段 referrer 直接映射。
remoteip metadata.event_type:“USER_RESOURCE_ACCESS” 如果 remoteip 字段为空,解析器会将 event_type 设置为“USER_RESOURCE_ACCESS”。
remoteip principal.ip 直接从原始日志字段 remoteip 映射而来。
requester target.resource.attribute.labels.key:“Access Point ARN”
target.resource.attribute.labels.valuerequester 的值
直接从原始日志字段 requester 映射而来。
requester_user principal.user.userid 直接从原始日志字段 requester_user 映射而来。
requestid network.session_id 直接从原始日志字段 requestid 映射而来。
request_time_ms network.session_duration.nanos 直接从原始日志字段 request_time_ms 映射而来,经过转换为整数、将“-”替换为“0”并用零填充以表示纳秒。
signatureversion target.resource.attribute.labels.key:“签名版本”
target.resource.attribute.labels.valuesignatureversion 的值
直接从原始日志字段 signatureversion 映射而来。
time metadata.event_timestamp 从原始日志字段 time 解析并转换为时间戳。
tlsVersion network.tls.version 直接从原始日志字段 tlsVersion 映射而来。
useragent network.http.user_agent 从移除引号后的原始日志字段 useragent 直接映射。
(Parser Logic) metadata.event_type:“NETWORK_HTTP” 解析器会将默认 event_type 设置为“NETWORK_HTTP”。
(Parser Logic) metadata.log_type:“AWS_S3_SERVER_ACCESS” 解析器将 log_type 设置为“AWS_S3_SERVER_ACCESS”。
(Parser Logic) metadata.product_name:“AWS S3 Server Access” 解析器将 product_name 设置为“AWS S3 Server Access”。
(Parser Logic) metadata.product_version:“HTTP/http_version 解析器使用提取的 http_version 设置 product_version
(Parser Logic) metadata.vendor_name:“AMAZON” 解析器将 vendor_name 设置为“AMAZON”。
(Parser Logic) network.application_protocol:“HTTP” 如果不存在 ciphersuite 字段,解析器会将 application_protocol 设置为“HTTP”。
(Parser Logic) timestamp 解析器会在处理事件时将事件 timestamp 设置为当前时间。

变化

2023-07-19

  • bug 修复 -
  • 修改了 Grok 模式,以便在没有数据时处理连字符 (-)。
  • 将“aclRequired”映射到“target.resource.attribute.labels”。

2023-05-04

  • 增强功能-
  • 添加了对 JSON 格式日志的支持。

2022-07-21

  • 新创建的解析器。

需要更多帮助?向社区成员和 Google SecOps 专业人士寻求解答。