完成工作负载的试运行时,您需要识别需要添加到许可名单的 IP 地址和身份列表。您还会发现某些工作负载需要基于设备的许可名单。如需授予受保护 Google Cloud 资源的受控访问权限,您可以使用 VPC Service Controls 访问权限级别。您可以实现访问权限级别所采用的实用方法基于 IP 地址、身份或设备。
在基于 IP 的许可名单中,访问权限级别仅支持使用公共 IP CIDR 范围。由于此方法允许来自此 IP 范围的所有受保护 API,因此这些 IP 后面的环境必须受信任且受到控制。该许可名单的典型使用场景是允许从本地网络访问边界。下图展示了基于 IP 地址的许可名单如何阻止和允许边界访问:
在上图中,有效身份将尝试访问边界。如果访问尝试来自任何互联网 IP 地址,访问就会遭到拒绝。但是,如果是来自公司的公共 IP 地址,则允许访问。
此场景的一种变体是,您允许从部署在其他项目或组织中的私有资源进行边界访问。在此用例中,源项目中必须有一个 Cloud NAT 网关。Cloud NAT 与专用 Google 访问通道集成,可自动在资源的子网上启用专用 Google 访问通道,并将流量保持在 Google APIs 和服务的内部网络中,而不是通过 Cloud NAT 网关的外部 IP 地址路由到互联网。由于流量在内部 Google 网络中路由,因此 AuditLog 对象的 RequestMetadata.caller_ip 字段会被隐去为 gce-internal-ip。在这种情况下,如需允许边界访问,应配置入站流量规则,依据项目或服务账号等属性进行访问控制,而不是基于外部源 IP 地址设置访问权限级别。
基于调用者身份授予访问权限
如需实现基于身份的许可名单,您可以将服务账号和组织超级用户添加到许可名单。边界向任何 IP 地址中的那些身份开放,因此您需要确保身份得到充分保护。您还需要确保避免为已添加到许可名单的服务账号创建密钥。将用户身份添加到边界上的许可名单并不常见(通常不能将群组添加到许可名单)。
设备信任(也称为“受信任端点”)需要有效的组织用户登录 Chrome 浏览器或 Chromebook。设备信任适用于操作系统登录会话。例如,已登录和运行 Chrome 会话的 Windows 用户(不需要打开浏览器)可以对受保护的边界 API 成功调用 gcloud CLI 命令。但是,同一机器上的其他 Windows 用户会话无法对受保护的边界 API 调用命令。
[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-09-04。"],[],[],null,["# Design access levels\n\nThis document describes access-level implementations and provides\nrecommendations for initiating service perimeter enforcement based on\nallowlists.\n\nWhen you complete a dry-run execution of workloads, you identify a list of IP\naddresses and identities that you need to add to an allowlist. You might also\nfind that some workloads need a device-based allowlist. To grant controlled\naccess to protected Google Cloud resources, you can use\nVPC Service Controls access levels. Some practical ways that you can\nimplement access levels are based on IP address, identity, or device.\n\nFor more information, see [Context-aware access with ingress rules](/vpc-service-controls/docs/context-aware-access).\n\n### Granting access based on source IP\n\nYou can only use\n[public IP CIDR ranges](/access-context-manager/docs/access-level-attributes#ip-subnetworks)\nin the access levels for IP-based allowlists. Since this method allows all\nprotected APIs from this IP range, the environment behind these IPs must be\ntrusted and controlled. A typical usage scenario for this allowlist is to allow\nperimeter access from on-premises networks. The following diagram shows how an\nIP-based allowlist blocks and allows perimeter access:\n\nIn the preceding diagram, a valid identity attempts to access the perimeter.\nThe access attempts are rejected when they originate from any internet IP\naddresses. However, access is allowed when it is sourced from the corporate\npublic IP addresses.\n\nA variation on this scenario is when you allow perimeter access from\nprivate resources deployed in a different project or organization. In this use\ncase, a Cloud NAT gateway is required in the source project.\n[Cloud NAT](/nat/docs/nat-product-interactions#interaction-pga)\nhas an integration with [Private Google Access](/vpc/docs/configure-private-google-access)\nthat automatically enables Private Google Access on the resource's subnet,\nand keeps the traffic to Google APIs and services internal, instead of routing\nit to the internet using the Cloud NAT gateway external IP address.\nAs the traffic is routed within the internal Google network, the\n`RequestMetadata.caller_ip` field of the `AuditLog` object is redacted to\n`gce-internal-ip`. To allow perimeter access in this case, you need to\nconfigure an ingress rule to allow access based on other attributes such as\nthe project or service account, instead of configuring an access level based\non the external source IP address.\n\n### Granting access based on caller identity\n\nTo implement an identity-based allowlist, you add service accounts and\n[organization super administrators](/resource-manager/docs/super-admin-best-practices)\nto an allowlist. The perimeter is open for these identities from any IP address,\nso you need to make sure that the identities are well-guarded. You also need to\nmake sure that you avoid minting keys for service accounts that you have added\nto an allowlist. It is uncommon to add user identities to an allowlist (groups\ncan't be added to an allowlist) on a perimeter.\n\nResources within the perimeter can be accessed through VMs within the\nperimeter, from trusted on-premises networks, or from trusted devices. We\nrecommend using [Cloud Workstations](/workstations/docs/overview) to access\nresources within perimeters because VPC Service Controls doesn't support\n[Cloud Shell](/vpc-service-controls/docs/supported-products#shell).\n| **Note:** You can only implement an identity-based allowlist using access levels by using the [gcloud CLI](/access-context-manager/docs/create-basic-access-level#members-example). You can use the Google Cloud console to configure ingress rules that implement identity-based access levels.\n\n### Qualifying access based on the caller device attributes\n\nDevice trust, also called *trusted endpoint*, relies on having a valid\norganization user signed in to a Chrome browser or to a Chromebook. The trust\napplies to the OS signed-in session. For example, a Windows user that is signed\nin and running a Chrome session (the browser doesn't need to be open) can\nsuccessfully call gcloud CLI commands on protected perimeter APIs.\nHowever, a different Windows user session on the same machine can't call\ncommands on the protected perimeter APIs.\n| **Note:** Caller device attributes are available only if you are using Chrome Enterprise Premium.\n\nThe following device conditions are useful to establish device trust:\n\n- [**Verified Chrome OS**](https://developers.google.com/chrome/verified-access/developer-guide)\n is a highly secure, cryptographically verified condition that indicates that\n a valid organization user is signed in to a securely booted Chromebook. This\n is a recommended tier 1 trust condition.\n\n- [**Require admin approval for device access**](https://support.google.com/cloudidentity/answer/7508418)\n allows Cloud Identity administrators to approve each device before any\n access is granted. By default, devices are auto-approved if they have a\n valid organization user signed in. However, we recommend turning off the\n auto-approval option.\n\n- **Require corp owned device** relies on the Chrome agent retrieving the\n serial number from the OS, which usually comes from the BIOS. This number\n must match existing serial numbers that you have\n [entered into Cloud Identity](https://support.google.com/cloudidentity/answer/7129612).\n\n Because the serial number isn't authoritative in non-Chrome OS devices, a\n user with elevated administrator privileges might be able to spoof the\n serial number. We recommend using this condition only as a tier 2 check.\n\n| **Note:** For trust to apply, the user and device must be in the same organization as the Google Cloud resources.\n\nFor a sample tracker for granting controlled access based on the conditions\ndiscussed in the preceding list, see\n[VPC Service Controls onboarding template - allowlist (PDF)](/static/solutions/vpc-service-controls-enterprise-best-practices-use-cases-template.pdf).\n\n### Initiate enforcement\n\nAfter you design the allowlist and update access levels, we recommend that you\nexecute the workloads again to confirm that there aren't any violations. If the\nworkloads execute without violations, you can initiate VPC Service Controls\nenforcement without impacting the applications.\n\nWhen you plan for enforcement, include the following:\n\n- Choose an enforcement date and communicate that date to all related teams.\n- Ensure that the security operations and incident response teams are aware of the deployment. Additionally, make sure that individuals with appropriate permissions inspect logs and approve additional allowlists, if necessary.\n- Ensure that the situation response team can open a Google Cloud support case, if any questions or issues arise.\n- Create or modify perimeter and access levels using automation tools like [Terraform](https://registry.terraform.io/modules/terraform-google-modules/vpc-service-controls/google/0.1.0/submodules/regular_service_perimeter). We recommend against performing these tasks manually.\n\nWhen you initiate enforcement, start by moving projects that are associated\nwith a single workload from the dry run perimeter to the live perimeter. Make\nsure to allow time for the application to run correctly while you observe the\nviolation logs. Repeat the process for remaining workloads one at a time.\n\nTo surface blocked violations, [configure an aggregated logging sink](/logging/docs/export/aggregated_sinks) that sends audit logs for all projects in the perimeter to BigQuery. Then, run the following query: \n\n SELECT\n receiveTimestamp, #time of violation\n Resource.labels.service, #protected Google Cloud service being blocked\n protopayload_auditlog.methodName, #method name being called\n resource.labels.project_id as PROJECT, #protected project blocking the call\n protopayload_auditlog.authenticationInfo.principalEmail, #caller identity\n protopayload_auditlog.requestMetadata.callerIp, #caller IP\n JSON_EXTRACT(protopayload_auditlog.metadataJson, '$.dryRun') as DRYRUN, #dry-run indicator\n JSON_EXTRACT(protopayload_auditlog.metadataJson, '$.violationReason') as REASON, #reason for violation\n protopayload_auditlog.metadataJson, #raw violation entry\n FROM `BQ_DATASOURCE_NAME.cloudaudit_googleapis_com_policy_*`\n WHERE JSON_EXTRACT(protopayload_auditlog.metadataJson, '$.dryRun') is null #exclude logs from a dry-run perimeter\n\nWhat's next\n-----------\n\n- Learn how to [allow access to protected resources from outside the perimeter](/vpc-service-controls/docs/use-access-levels).\n- Learn how to [list, update, and delete service perimeters](/vpc-service-controls/docs/manage-service-perimeters)."]]