收集 Forseti Open Source 日志
解析器版本: 2.0
本文档介绍了如何使用 Google Cloud Storage V2 将 Forseti Open Source 日志注入到 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 控制台
- 前往 Google Cloud 控制台。
- 选择您的项目或创建一个新项目。
- 在导航菜单中,依次前往 Cloud Storage > 存储分区。
- 点击创建存储桶 。
提供以下配置详细信息:
设置 值 指定存储桶的名称 输入一个全局唯一的名称(例如 forseti-violations-export)位置类型 根据您的需求进行选择(区域、双区域、多区域) 位置 选择位置(例如 us-central1)存储类别 标准 (建议用于经常访问的日志) 访问权限控制 统一 (推荐) 保护工具 可选:启用对象版本控制或保留政策 点击创建 。
使用 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。
- 使用 SSH 连接到 Forseti 服务器虚拟机:
bash gcloud compute ssh forseti-server-vm --project=YOUR_PROJECT_ID --zone=YOUR_ZONE - 打开配置文件进行修改:
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 - 前往
notifier部分,找到resources子部分。 对于要导出的每种违规行为资源类型,配置
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 路径(必须包含尾部斜杠)。
保存文件,并在必要时将其上传回 GCS。
重新加载配置:
bash forseti server configuration reload验证:
bash forseti server configuration get | grep gcs_violations
检索 Google SecOps 服务帐号
在 Google SecOps 中配置 Feed
- 依次前往 SIEM 设置 > Feed。
- 点击 Add New Feed (添加新 Feed),然后选择 Configure a single feed (配置单个 Feed)。
- Feed 名称:输入一个名称(例如
Forseti Violations)。 - 来源类型:选择 Google Cloud Storage V2。
- 日志类型:选择 Forseti Open Source。
- 点击 Get Service Account (获取服务账号)。
- 复制唯一的服务帐号电子邮件地址(例如
chronicle-12345678@chronicle-gcp-prod.iam.gserviceaccount.com)。 - 点击下一步 。
- 指定输入参数:
- 存储桶网址:
gs://forseti-violations-export/violations/ - 来源删除选项:根据您的偏好进行选择(例如,对于测试,选择从不 )。
- 存储桶网址:
- 点击下一步 ,检查配置,然后点击提交 。
向 Google SecOps 服务帐号授予 IAM 权限
使用 Google Cloud 控制台
- 依次前往 Cloud Storage > 存储分区。
- 点击您的存储桶名称,然后前往权限 标签页。
- 点击授予访问权限 。
- 添加主账号:粘贴 Google SecOps 服务帐号电子邮件地址。
- 分配角色:选择 Storage Object Viewer。(如果您在 Feed 中选择了删除选项,请使用 Storage Object Admin )。
- 点击保存 。
使用 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 映射到特定类型。 |