将 Cloud Asset Inventory 与 Google SecOps 集成

本文档介绍了如何将 Cloud Asset Inventory 与 Google Security Operations (Google SecOps) 集成。

集成版本:12.0

在 Google SecOps 平台中,Cloud Asset Inventory 的集成称为 Google Cloud Asset Inventory

准备工作

如需使用此集成,您需要一个 Identity and Access Management (IAM) 角色和一个Google Cloud 服务账号。

创建和配置自定义 IAM 角色

如需创建自定义 IAM 角色并为其配置特定权限,请完成以下步骤:

  1. 在 Google Cloud 控制台中,前往 IAM 角色页面。

    打开“角色”

  2. 点击创建角色,以创建具有集成所需权限的自定义角色。

  3. 对于新的自定义角色,请提供标题说明和唯一的 ID

  4. 角色发布阶段设置为正式版

  5. 向创建的角色添加以下权限:

    cloudasset.assets.searchAllResources
    

创建和配置服务账号

如需将 Cloud Asset Inventory 与 Google SecOps 集成,您可以使用现有服务账号,也可以创建新的服务账号。如需有关创建服务账号的指导,请参阅创建服务账号

Cloud Asset Inventory 集成要求您向服务账号授予上一部分中创建的自定义角色和 Cloud Asset Viewer 角色。

如果您未使用工作负载身份电子邮件地址来配置集成,请在创建服务账号后以 JSON 格式创建服务账号密钥。配置集成参数时,您需要提供下载的 JSON 密钥文件的完整内容。

出于安全考虑,我们建议您使用工作负载身份电子邮件地址,而不是服务账号 JSON 密钥。如需详细了解工作负载身份,请参阅工作负载的身份

向现有主账号授予自定义角色

向所选主账号授予新的自定义角色后,该主账号便可以更改组织中任何用户的权限。

如需向现有主账号授予自定义角色,请完成以下步骤:

  1. 在 Google Cloud 控制台中,前往 IAM 页面。

    转到 IAM

  2. 过滤条件字段中,粘贴您用于 Cloud Asset Inventory 集成的Workload Identity 邮箱值,然后搜索现有主账号。

  3. 点击 修改主账号。 系统会打开修改对“PROJECT”的访问权限对话框。

  4. 分配角色下,点击 添加其他角色

  5. 选择 Cloud Asset Inventory 的预定义角色

  6. 点击保存

集成参数

Cloud Asset Inventory 集成需要以下参数:

参数 说明
API Root 必需

Cloud Asset Inventory 实例的 API 根。

默认值为 https://cloudasset.googleapis.com

Organization ID 可选

要在 Cloud Asset Inventory 集成中使用的组织 ID。

Project ID 可选

用于 Cloud Asset Inventory 集成的项目 ID。如果您未为此参数设置值,集成会从 User's Service Account 参数中提供的 JSON 文件内容检索项目 ID。

User's Service Account 必需

服务账号密钥 JSON 文件的内容。

您可以配置此参数或 Workload Identity Email 参数。

如需配置此参数,请提供您在创建服务账号时下载的服务账号密钥 JSON 文件的完整内容。

Quota Project ID 可选

您用于 Google Cloud API 和结算的 Google Cloud 项目 ID。此形参要求您向服务账号授予 Service Usage Consumer 角色。

如果您未为此参数设置值,集成会从您的 Google Cloud 服务账号中检索项目 ID。

Workload Identity Email 可选

您的服务账号的客户端电子邮件地址。

您可以配置此参数或 User's Service Account 参数。

如需使用工作负载身份联合模拟服务账号,请向您的服务账号授予 Service Account Token Creator 角色。如需详细了解工作负载身份以及如何使用它们,请参阅工作负载的身份

Verify SSL 必需

如果选择此项,集成会验证用于连接到 Cloud Asset Inventory 服务器的 SSL 证书是否有效。

此选项将会默认选中。

如需详细了解如何在 Google SecOps 中配置集成,请参阅配置集成

如果需要,您可以在稍后阶段进行更改。配置集成实例后,您可以在剧本中使用该实例。如需详细了解如何配置和支持多个实例,请参阅支持多个实例

操作

如需详细了解操作,请参阅处理“工作台”中的待处理操作执行手动操作

丰富资源

使用 Enrich Resource 操作,通过 Cloud Asset Inventory 丰富有关 Google Cloud资源的信息。

此操作不会在 Google SecOps 实体上运行。

操作输入

如需配置 丰富资源操作,请使用以下参数:

参数 说明
Resource Names 必需

一个英文逗号分隔的列表,其中包含要获取详细信息的资源的资源名称。

如需配置此参数,请输入完整的元数据资源名称,格式如下://cloudresourcemanager.googleapis.com/projects/PROJECT_ID

Fields To Return 可选

以英文逗号分隔的要返回的字段列表。

默认值为 *

值示例: assetTypeprojectfoldersorganizationdisplayNamedescriptionlocationlabelsnetworkTagskmsKeyscreateTimeupdateTimestateadditionalAttributesparentFullResourceNameparentAssetType

该操作始终返回 displayName 字段。

您还可以选择配置高级过滤条件。例如,如需从 additionalAttributes 返回特定键,请输入 additionalAttributes.{key}。如需从 additionalAttributes 中排除特定键,请输入 -additionalAttributes.{key}

操作输出

丰富资源操作提供以下输出:

操作输出类型 可用性
案例墙附件 不可用
案例墙链接 不可用
“支持请求墙”表格 不可用
丰富化表 不可用
JSON 结果 可用
输出消息 可用
脚本结果 可用
JSON 结果

以下示例展示了使用丰富资源操作时收到的 JSON 结果输出:

[
  {
    "Entity": "//iam.googleapis.com/projects/PROJECT/serviceAccounts/SERVICE_ACCOUNT/keys/KEY_ID",
    "EntityResult": {
      "additionalAttributes": {
        "email": "email@example.iam.gserviceaccount.com",
        "uniqueId": 123456789
      },
      "name": "//iam.googleapis.com/projects/PROJECT/serviceAccounts/SERVICE_ACCOUNT/keys/KEY_ID",
      "assetType": "iam.googleapis.com/ServiceAccountKey",
      "project": "projects/PROJECT",
      "displayName": "projects/PROJECT/serviceAccounts/SERVICE_ACCOUNT@PROJECT.iam.gserviceaccount.com/keys/KEY_ID",
      "createTime": "2022-05-26T17:35:07Z",
      "versionedResources": [
        {
          "version": "v1",
          "resource": {
            "keyAlgorithm": "KEY_ALG_RSA_2048",
            "keyOrigin": "GOOGLE_PROVIDED",
            "keyType": "USER_MANAGED",
            "name": "projects/PROJECT/serviceAccounts/SERVICE_ACCOUNT@PROJECT.iam.gserviceaccount.com/keys/KEY_ID",
            "validAfterTime": "2022-05-26T17:35:07Z",
            "validBeforeTime": "9999-12-31T23:59:59Z"
          }
        }
      ],
      "organization": "organizations/ORGANIZATION",
      "parentFullResourceName": "//iam.googleapis.com/projects/PROJECT/serviceAccounts/SERVICE_ACCOUNT@PROJECT.iam.gserviceaccount.com",
      "parentAssetType": "iam.googleapis.com/ServiceAccount"
    }
  }
]
输出消息

丰富资源操作可以返回以下输出消息:

输出消息 消息说明

Successfully enriched the following resources using information from Google Cloud Asset Inventory: ASSET_IDENTIFIER

Action wasn't able to enrich the following resources using information from Google Cloud Asset Inventory: ASSET_IDENTIFIER

None of the provided resources were enriched.

操作成功。
Error executing action "Enrich resources". Reason: ERROR_REASON

操作失败。

检查与服务器的连接、输入参数或凭据。

脚本结果

下表列出了使用丰富资源操作时脚本结果输出的值:

脚本结果名称
is_success TrueFalse

获取资源快照

使用 Get Resource Snapshot 操作通过 Cloud Asset Inventory 获取资源的相关信息。

此操作不适用于 Google SecOps 实体。

操作输入

如需配置 Get Resource Snapshot 操作,请使用以下参数:

参数 说明
Resource Names 必需

以英文逗号分隔的资源列表,用于获取详细信息。

如需配置此参数,请输入完整的元数据资源名称,格式如下://cloudresourcemanager.googleapis.com/projects/PROJECT_ID

Fields To Return 可选

以英文逗号分隔的要返回的字段列表。

以以下格式输入每个字段:

assets.FIELD

值示例如下:assets.asset.name, assets.asset.assetType, assets.asset.resource.data

该操作始终返回 assets.asset.name 字段。

默认值为 *

操作输出

获取资源快照操作提供以下输出:

操作输出类型 可用性
案例墙附件 不可用
案例墙链接 不可用
“支持请求墙”表格 不可用
丰富化表 不可用
JSON 结果 可用
输出消息 可用
脚本结果 可用
JSON 结果

以下示例展示了使用获取资源快照操作时收到的 JSON 结果输出:

Google Cloud的 JSON 结果
    [
 {
   "Entity": "//compute.googleapis.com/projects/example-project/zones/us-central1-a/instances/example-instance",
   "EntityResult": {
     "window": {
       "startTime": "2023-08-14T19:43:41.805828Z",
       "endTime": "2262-04-11T23:47:16.854775807Z"
     },
     "asset": {
       "name": "//compute.googleapis.com/projects/example-project/zones/us-central1-a/instances/example-instance",
       "assetType": "compute.googleapis.com/Instance",
       "resource": {
         "version": "v1",
         "discoveryDocumentUri": "https://www.googleapis.com/discovery/v1/apis/compute/v1/rest",
         "discoveryName": "Instance",
         "parent": "//cloudresourcemanager.googleapis.com/projects/example-project-id",
         "data": {
           "description": "",
           "serviceAccounts": [
             {
               "email": "user@example.com",
               "scopes": [
                 "https://www.googleapis.com/auth/devstorage.read_only",
                 "https://www.googleapis.com/auth/logging.write",
                 "https://www.googleapis.com/auth/monitoring.write",
                 "https://www.googleapis.com/auth/servicecontrol",
                 "https://www.googleapis.com/auth/service.management.readonly",
                 "https://www.googleapis.com/auth/trace.append"
               ]
             }
           ],
           "lastStartTimestamp": "2022-05-26T01:44:52.756-07:00",
           "deletionProtection": false,
           "name": "example-name",
           "keyRevocationActionType": "NONE_ON_KEY_REVOCATION",
           "canIpForward": false,
           "shieldedInstanceIntegrityPolicy": {
             "updateAutoLearnPolicy": true
           },
           "zone": "https://www.googleapis.com/compute/v1/projects/example-project/zones/us-central1-a",
           "resourceStatus": {},
           "scheduling": {
             "onHostMaintenance": "MIGRATE",
             "preemptible": false,
             "provisioningModel": "STANDARD",
             "automaticRestart": true
           },
           "machineType": "https://www.googleapis.com/compute/v1/projects/example-project/zones/us-central1-a/machineTypes/e2-micro",
           "confidentialInstanceConfig": {
             "enableConfidentialCompute": false
           },
           "selfLink": "https://www.googleapis.com/compute/v1/projects/example-project/zones/us-central1-a/instances/example-instance",
           "id": "example-id",
           "fingerprint": "example-fingerprint",
           "startRestricted": false,
           "networkInterfaces": [
             {
               "network": "https://www.googleapis.com/compute/v1/projects/example-project/global/networks/example-network",
               "stackType": "IPV4_ONLY",
               "name": "example",
               "subnetwork": "https://www.googleapis.com/compute/v1/projects/example-project/regions/us-central1/subnetworks/example-network-subnet",
               "accessConfigs": [
                 {
                   "type": "ONE_TO_ONE_NAT",
                   "name": "External NAT",
                   "natIP": "192.0.2.1",
                   "networkTier": "PREMIUM"
                 }
               ],
               "fingerprint": "example-fingerprint",
               "networkIP": "203.0.113.2"
             }
           ],
           "allocationAffinity": {
             "consumeAllocationType": "ANY_ALLOCATION"
           },
           "labelFingerprint": "example-label",
           "shieldedInstanceConfig": {
             "enableSecureBoot": false,
             "enableVtpm": true,
             "enableIntegrityMonitoring": true
           },
           "cpuPlatform": "Intel Broadwell",
           "creationTimestamp": "2022-05-26T01:44:40.323-07:00",
           "status": "RUNNING",
           "disks": [
             {
               "guestOsFeatures": [
                 {
                   "type": "VIRTIO_SCSI_MULTIQUEUE"
                 },
                 {
                   "type": "SEV_CAPABLE"
                 },
                 {
                   "type": "UEFI_COMPATIBLE"
                 },
                 {
                   "type": "GVNIC"
                 }
               ],
               "interface": "SCSI",
               "shieldedInstanceInitialState": {
                 "dbxs": [
                   {
                     "content": "2gcDBhMRFQAAAAAAAAAAABENAAAAAvEOndK",
                     "fileType": "BIN"
                   }
                 ],
                 "dbx": [
                   {
                     "fileType": "BIN",
                     "content": "2gcDBhMRFQAAAAAAAAAAABENAAAAAvEOndK"
                   }
                 ]
               },
               "diskSizeGb": "10",
               "deviceName": "example-device-name",
               "type": "PERSISTENT",
               "source": "https://www.googleapis.com/compute/v1/projects/example-project/zones/us-central1-a/disks/example-instance",
               "boot": true,
               "licenses": [
                 "https://www.googleapis.com/compute/v1/projects/example-project/global/licenses"
               ],
               "index": 0,
               "autoDelete": true,
               "mode": "READ_WRITE"
             }
           ],
           "tags": {
             "items": [
               "http-server"
             ],
             "fingerprint": "example-fingerprint"
           },
           "displayDevice": {
             "enableDisplay": false
           },
           "reservationAffinity": {
             "consumeReservationType": "ANY_ALLOCATION"
           }
         },
         "location": "us-central1-a"
       },
       "ancestors": [
         "projects/example-project-id",
         "organizations/example-org-id"
       ],
       "updateTime": "2023-08-14T19:43:41.805828Z"
     }
   }
 },
 {
   "Entity": "//iam.googleapis.com/projects/example-project/serviceAccounts/example-account-id",
   "EntityResult": {
     "window": {
       "startTime": "2023-12-22T13:37:50Z",
       "endTime": "2262-04-11T23:47:16.854775807Z"
     },
     "asset": {
       "name": "//iam.googleapis.com/projects/example-project/serviceAccounts/example-account-id",
       "assetType": "iam.googleapis.com/ServiceAccount",
       "resource": {
         "version": "v1",
         "discoveryDocumentUri": "https://iam.googleapis.com/$discovery/rest",
         "discoveryName": "ServiceAccount",
         "parent": "//cloudresourcemanager.googleapis.com/projects/example-project-id",
         "data": {
           "name": "projects/example-project/serviceAccounts/cloud-asset-inventory-auto@example-project.iam.gserviceaccount.com",
           "projectId": "example-project",
           "email": "cloud-asset-inventory-auto@example-project.iam.gserviceaccount.com",
           "uniqueId": "example-account-id",
           "displayName": "Cloud Asset Inventory Automation",
           "oauth2ClientId": "example-account-id"
         }
       },
       "ancestors": [
         "projects/example-project-id",
         "organizations/example-org-id"
       ],
       "updateTime": "2023-12-22T13:37:50Z"
     }
   }
 }
]
AWS 的 JSON 结果
[
   {
       "Entity": "//cloudasset.googleapis.com/organizations/example-org-id/otherCloudConnections/aws/arn:aws:s3:::aps-max-test-bucket",
       "EntityResult": {
           "assets": [
               {
                   "window": {
                       "startTime": "2024-01-24T17:51:03.412233028Z",
                       "endTime": "2262-04-11T23:47:16.854775807Z"
                   },
                   "asset": {
                       "name": "//cloudasset.googleapis.com/organizations/example-org-id/otherCloudConnections/aws/arn:aws:s3:::aps-max-test-bucket",
                       "assetType": "cloudasset.googleapis.com/AWS::S3::Bucket",
                       "resource": {
                           "version": "v1",
                           "discoveryDocumentUri": "n/a",
                           "discoveryName": "n/a",
                           "data": {
                               "dataSourceProvider": "AMAZON_WEB_SERVICES",
                               "supplementaryConfigurations": {
                                   "PublicAccessBlockConfiguration": {
                                       "BlockPublicPolicy": true,
                                       "RestrictPublicBuckets": true,
                                       "BlockPublicAcls": true,
                                       "IgnorePublicAcls": true
                                   },
                                   "TagSet": [
                                       {
                                           "Key": "my-key2",
                                           "Value": "my-value2"
                                       },
                                       {
                                           "Key": "my-key1",
                                           "Value": "my-value1"
                                       }
                                   ],
                                   "ServerSideEncryptionConfiguration": {
                                       "Rules": [
                                           {
                                               "ApplyServerSideEncryptionByDefault": {
                                                   "SSEAlgorithm": "AES256"
                                               },
                                               "BucketKeyEnabled": true
                                           }
                                       ]
                                   },
                                   "AccessControlPolicy": {
                                       "Grants": [
                                           {
                                               "Grantee": {
                                                   "DisplayName": "example",
                                                   "ID": "example-id",
                                                   "Type": "CanonicalUser"
                                               },
                                               "Permission": "FULL_CONTROL"
                                           }
                                       ],
                                       "Owner": {
                                           "DisplayName": "example",
                                           "ID": "example-id"
                                       }
                                   }
                               },
                               "configuration": {
                                   "Name": "aps-max-test-bucket",
                                   "CreationDate": "2023-12-04T15:29:50+00:00"
                               },
                               "tags": {
                                   "my-key2": "my-value2",
                                   "my-key1": "my-value1"
                               },
                               "originalResourceName": "arn:aws:s3:::aps-max-test-bucket",
                               "awsAccount": "arn:aws:organizations::example-id:account/example-account/example-account-id"
                           },
                           "location": "global"
                       },
                       "ancestors": [
                           "organizations/example-org-id"
                       ],
                       "updateTime": "2024-01-24T17:51:03.412233028Z"
                   }
               }
           ]
       }
   }
]
输出消息

获取资源快照操作可以返回以下输出消息:

输出消息 消息说明
Successfully returned information about the following resources using Google Cloud Asset Inventory: ASSET_IDENTIFIER

Action wasn't able to return information about the following resources using Google Cloud Asset Inventory: ASSET_IDENTIFIER.

No information was found for the provided resources.

操作成功。
Error executing action "Get Resource Snapshot". Reason: ERROR_REASON

操作失败。

检查与服务器的连接、输入参数或凭据。

脚本结果

下表列出了使用获取资源快照操作时脚本结果输出的值:

脚本结果名称
is_success TrueFalse

列出服务账号角色

使用 List Service Account Roles 操作,通过 Cloud Asset Inventory 列出与 Google Cloud 服务账号相关的角色。

此操作不适用于 Google SecOps 实体。

操作输入

如需配置列出服务账号角色操作,请使用以下参数:

参数 说明
Service Accounts 必需

要获取详细信息的服务账号的英文逗号分隔列表。

Check Roles 可选

要检查的与服务账号相关的角色列表(以英文逗号分隔),例如 roles/cloudasset.owner

Check Permissions 可选

要检查的与服务账号相关的权限的逗号分隔列表,例如 cloudasset.assets.listResource

Expand Permissions 可选

如果选择此项,操作会返回与资源相关的所有唯一权限的信息。

默认情况下未选中。

Max Roles To Return 必需

要返回的与服务账号相关的角色数量。

默认值为 100。

Max Permissions To Return 必需

要返回的与服务账号相关的权限数量。

操作输出

列出服务账号角色操作提供以下输出:

操作输出类型 可用性
案例墙附件 不可用
案例墙链接 不可用
“支持请求墙”表格 不可用
丰富化表 不可用
JSON 结果 可用
输出消息 可用
脚本结果 可用
JSON 结果

以下示例展示了使用列出服务账号角色操作时收到的 JSON 结果输出:

{
   "roles": ["role1", "role2"],
   "unique_permissions": ["permission1", "permission2"]
}
输出消息

列出服务账号角色操作可以返回以下输出消息:

输出消息 消息说明

Successfully enriched for the following service accounts using information from Google Cloud Asset Inventory: ASSET_IDENTIFIER

Action wasn't able to enrich the following service accounts using information from Google Cloud Asset Inventory: ASSET_IDENTIFIER

None of the service accounts were enriched.

操作成功。
Error executing action "List Service Account Roles". Reason: ERROR_REASON

操作失败。

检查与服务器的连接、输入参数或凭据。

Ping

使用 Ping 操作测试与 Cloud Asset Inventory 的连接。

此操作不会在 Google SecOps 实体上运行。

操作输入

无。

操作输出

Ping 操作提供以下输出:

操作输出类型 可用性
案例墙附件 不可用
案例墙链接 不可用
“支持请求墙”表格 不可用
丰富化表 不可用
JSON 结果 不可用
输出消息 可用
脚本结果 可用
输出消息

Ping 操作可以返回以下输出消息:

输出消息 消息说明
Successfully connected to the Google Cloud Asset Inventory server with the provided connection parameters! 操作成功。
Failed to connect to the Google Cloud Asset Inventory server! 操作失败。
脚本结果

下表列出了使用 Ping 操作时脚本结果输出的值:

脚本结果名称
is_success TrueFalse

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