【问题标题】:Service account with org viewer role not able to perform any actions具有组织查看者角色的服务帐户无法执行任何操作
【发布时间】:2021-08-31 16:07:10
【问题描述】:

我创建了一个具有组织查看者权限的 GCP 服务帐户(因此我假设在所有项目中都具有读取权限)

▶ gcloud organizations get-iam-policy 83838383838383 --flatten="bindings[].members" --format='table(bindings.role)' --filter="bindings.members:my-sa@my-project-id.iam.gserviceaccount.com"
ROLE
roles/resourcemanager.organizationViewer

然后我在本地激活它

▶ gcloud auth activate-service-account my-sa@my-project-id.iam.gserviceaccount.com --key-file=keyfile.json
Activated service account credentials for: [my-sa@my-project-id.iam.gserviceaccount.com]

然后尝试执行compute disk list(在创建 SA 的同一项目上)

▶ gcloud compute disks list
ERROR: (gcloud.compute.disks.list) Some requests did not succeed:
 - Required 'compute.disks.list' permission for 'projects/my-project-id'

为什么会这样?

【问题讨论】:

  • 添加项目查看者角色,查看项目资源
  • 我这样做了,令我惊讶的是,它为同一组织下的所有个项目提供了项目查看器
  • 如果您在组织级别设置项目查看器,是的,您在组织的所有项目中都具有项目查看器角色,通过继承。

标签: security google-cloud-platform permissions google-iam google-cloud-iam


【解决方案1】:

错误消息指出服务帐户没有权限compute.disks.list

角色roles/resourcemanager.organizationViewer有什么权限?

gcloud iam roles describe roles/resourcemanager.organizationViewer --format=json

注意角色只有一个权限resourcemanager.organizations.get

{
  "description": "Access only to view an Organization.",
  "etag": "AA==",
  "includedPermissions": [
    "resourcemanager.organizations.get"
  ],
  "name": "roles/resourcemanager.organizationViewer",
  "stage": "GA",
  "title": "Organization Viewer"
}

该权限允许查看组织详细信息,但不能查看组织的资源。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-04-02
    • 1970-01-01
    • 1970-01-01
    • 2019-09-08
    • 2021-07-25
    • 1970-01-01
    • 2020-09-04
    相关资源
    最近更新 更多