收集 Forseti 开源 日志

解析器版本:2.0

支持的国家/地区:

本文档介绍了如何使用 Cloud Storage V2 将 Forseti 开源日志注入 Google Security Operations。

Forseti Security 是一个由社区驱动的开源工具集合,旨在提高 Google Cloud 环境的安全性。Forseti 会拍摄 Google Cloud 资源的资产清单快照,扫描访问权限控制合规性,并提供对 Identity and Access Management (IAM) 政策的可见性。

准备工作

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

  • Google SecOps 实例。
  • 启用了 Cloud Storage API 的 Google Cloud 项目。
  • 拥有创建和管理 Cloud Storage 存储桶和 IAM 政策的权限。
  • 现有的 Forseti Security 部署。
  • 拥有 Forseti 服务器配置文件 (forseti_conf_server.yaml) 的访问权限。

创建 Cloud Storage 存储桶

使用 Google Cloud 控制台

  1. 前往 Google Cloud 控制台。
  2. 选择您的项目或创建一个新项目。
  3. 在导航菜单中,前往 Cloud Storage > 存储桶。
  4. 点击创建存储分区。
  5. 提供以下配置详细信息:

    设置 值
    指定存储桶的名称 输入一个全局唯一的名称(例如 forseti-violations-export)
    位置类型 根据您的需求进行选择(单区域、双区域、多区域)
    位置 选择位置(例如 us-central1)
    存储类别 标准(推荐用于频繁访问的日志)
    访问权限控制 统一(推荐)
    保护工具 可选:启用对象版本控制或保留政策
  6. 点击创建。

使用 gcloud 命令行工具

  • 或者,使用 gcloud 命令创建存储桶:

    gcloud storage buckets create gs://forseti-violations-export \
        --location=us-central1 \
        --default-storage-class=STANDARD
    
  • 将 forseti-violations-export 替换为您所需的全局唯一存储桶名称。

  • 将 us-central1 替换为您偏好的区域。

配置 Forseti Security 以将违规行为导出到 Cloud Storage

Forseti Security 使用 forseti_conf_server.yaml 文件中的通知程序配置将扫描器违规行为导出到 Cloud Storage。

  1. 使用 SSH 连接到 Forseti 服务器虚拟机: bash gcloud compute ssh forseti-server-vm --project=YOUR_PROJECT_ID --zone=YOUR_ZONE
  2. 打开配置文件进行修改: bash sudo nano /home/ubuntu/forseti-security/configs/forseti_conf_server.yaml 如果使用基于 Cloud Storage 的配置,请先下载该配置: bash gsutil cp gs://YOUR_FORSETI_SERVER_BUCKET/configs/forseti_conf_server.yaml ~/forseti_conf_server.yaml
  3. 前往 notifier 部分,找到 resources 子部分。
  4. 对于要导出的每种违规资源类型,请配置 gcs_violations 通知程序:

    notifier:
        resources:
            - resource: iam_policy_violations
                should_notify: true
                notifiers:
                    - name: gcs_violations
                        configuration:
                            data_format: csv
                            gcs_path: gs://forseti-violations-export/violations/
            - resource: firewall_rule_violations
                should_notify: true
                notifiers:
                    - name: gcs_violations
                        configuration:
                            data_format: csv
                            gcs_path: gs://forseti-violations-export/violations/
            - resource: cloudsql_acl_violations
                should_notify: true
                notifiers:
                    - name: gcs_violations
                        configuration:
                            data_format: csv
                            gcs_path: gs://forseti-violations-export/violations/
            - resource: bucket_acl_violations
                should_notify: true
                notifiers:
                    - name: gcs_violations
                        configuration:
                            data_format: csv
                            gcs_path: gs://forseti-violations-export/violations/
            - resource: config_validator_violations
                should_notify: true
                notifiers:
                    - name: gcs_violations
                        configuration:
                            data_format: csv
                            gcs_path: gs://forseti-violations-export/violations/
    

    关键参数:

    • resource:违规类型(例如 iam_policy_violations)。
    • data_format:设置为 csv 或 json。
    • gcs_path:Cloud Storage 路径(必须包含尾部斜杠)。
  5. 保存文件,并根据需要将其上传回 Cloud Storage。

  6. 重新加载配置: bash forseti server configuration reload

  7. 验证: bash forseti server configuration get | grep gcs_violations

检索 Google SecOps 服务账号

在 Google SecOps 中配置 Feed

  1. 依次前往设置 > 数据管理 > Feed。如果您使用的是 SIEM-only 平台,请依次前往设置 > Feed。
  2. 点击添加新 Feed,然后选择配置单个 Feed。
  3. Feed 名称:输入名称(例如 Forseti Violations)。
  4. 来源类型:选择 Google Cloud Storage V2。
  5. 日志类型:选择 Forseti 开源。
  6. 点击获取服务账号。
  7. 复制唯一的服务账号邮箱(例如 chronicle-12345678@chronicle-gcp-prod.iam.gserviceaccount.com)。
  8. 点击下一步。
  9. 指定输入参数:
    • 存储桶网址:gs://forseti-violations-export/violations/
    • 来源删除选项:根据您的偏好进行选择(例如,选择从不进行测试)。
  10. 点击下一步,检查配置,然后点击提交。

向 Google SecOps 服务账号授予 IAM 权限

使用 Google Cloud 控制台

  1. 前往 Cloud Storage > 存储桶。
  2. 点击您的存储桶名称,然后前往权限标签页。
  3. 点击授予访问权限。
  4. 添加主账号:粘贴 Google SecOps 服务账号邮箱。
  5. 分配角色:选择 Storage Object Viewer。(如果您在 Feed 中选择了删除选项,请使用 Storage Object Admin)。
  6. 点击保存。
  • 使用 gcloud 命令行工具

    gcloud storage buckets add-iam-policy-binding gs://forseti-violations-export \
        --member="serviceAccount:CHRONICLE_SERVICE_ACCOUNT_EMAIL" \
        --role="roles/storage.objectViewer"
    

UDM 映射表

日志字段 UDM 映射 逻辑
data.resource_data.instanceGroupUrls about 从 instanceGroupUrls 数组合并。
data.resource_data.nodePools.*.statusMessage metadata.description 来自 nodePool.statusMessage 的值。
data.resource_type metadata.event_type KMS/FW 的特定类型;否则为 GENERIC_EVENT。
data.scanner_index_id metadata.product_log_id 值直接复制为字符串。
不适用 metadata.product_name 设置为 FORSETI SECURITY。
不适用 metadata.vendor_name 设置为 FORSETI。
data.resource_data.direction network.direction 如果方向为 INGRESS,则设置为 INBOUND。
data.resource_data.endpoint principal.ip 直接复制的值。
data.full_name,serviceAccount principal.user.userid 从 full_name 或 serviceAccount 中提取。
data.violation_type security_result.category 映射到 POLICY_VIOLATION 或 ACL_VIOLATION。
data.rule_name security_result.rule_name 直接复制的值。
data.full_name target.asset.attribute.cloud.project.id 使用 grok 从 full_name 中提取。
data.resource_type target.resource.resource_type 根据 resource_type 映射到特定类型。

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