收集 Forseti Open Source 日志

解析器版本:2.0

支持的平台:

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

Forseti Security 是一组由社区驱动的开源工具,旨在提高 Google Cloud Platform 环境的安全性。Forseti 会拍摄 GCP 资源的清单快照、扫描访问权限控制合规性,并提供 Cloud IAM 政策的可见性。

准备工作

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

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

创建 Google 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 以将违规情况导出到 GCS

Forseti Security 使用 forseti_conf_server.yaml 文件中的通知程序配置将扫描器违规情况导出到 GCS。

  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 如果使用基于 GCS 的配置,请先下载: 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. 保存文件,并根据需要将其重新上传到 GCS。

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

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

检索 Google SecOps 服务账号

在 Google SecOps 中配置 Feed

  1. 前往 SIEM 设置 > Feed。
  2. 点击添加新 Feed,然后选择配置单个 Feed。
  3. Feed 名称:输入一个名称(例如 Forseti Violations)。
  4. 来源类型:选择 Google Cloud Storage V2。
  5. 日志类型:选择 Forseti Open Source。
  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 专业人士的解答。