Google Cloud 提供了两种组织政策限制条件,以帮助确保在整个组织范围内使用 CMEK:
constraints/gcp.restrictNonCmekServices用于要求 CMEK 保护。constraints/gcp.restrictCmekCryptoKeyProjects用于限制哪些 Cloud KMS 密钥可用于 CMEK 保护。
CMEK 组织政策仅适用于 支持的 Google Cloud 服务中新创建的资源。
所需的角色
为了确保每个用户在创建资源时都具有检查组织政策所需的权限,请让您的管理员为组织中的每个用户授予Organization Policy Viewer (roles/orgpolicy.policyViewer) IAM 角色。如需详细了解如何授予角色,请参阅管理对项目、文件夹和组织的访问权限。
此预定义角色包含 在创建资源时检查组织政策所需的权限。如需查看所需的确切权限,请展开所需权限部分:
所需权限
在创建资源时检查组织政策需要以下权限:
-
如需查看完整的组织政策详细信息:
orgpolicy.policy.get -
如需在创建资源时检查组织政策:
orgpolicy.policies.check
您的管理员也可以使用自定义角色或其他预定义角色向每个用户授予这些权限。
当组织政策处于有效状态时,创建受 CMEK 密钥保护的资源需要 orgpolicy.policies.check 权限
。 Google Cloud 没有此权限的用户可以使用 Google Cloud 控制台创建受 CMEK 保护的
资源,但他们可以选择 restrictCmekCryptoKeyProjects 限制条件不允许的 CMEK 密钥。如果选择的密钥不符合此限制条件,资源创建最终会失败。
要求 CMEK 保护
如需为组织要求 CMEK 保护,请配置 constraints/gcp.restrictNonCmekServices 组织政策。
作为列表限制条件,此限制条件接受的值是 Google Cloud
服务名称(例如 bigquery.googleapis.com)。如需使用此限制条件,请
提供服务名称列表并将限制条件设置为
拒绝。 Google Cloud 如果资源不受 CMEK 保护,此配置会阻止在这些服务中创建资源。换句话说,如果不指定 Cloud KMS 密钥,则在服务中创建资源的请求将失败。此外,此限制条件还会阻止从这些服务中的资源移除 CMEK 保护。此限制条件
只能应用于支持的服务。
限制使用 CMEK 的 Cloud KMS 密钥
如需限制哪些 Cloud KMS 密钥可用于 CMEK 保护,请配置 constraints/gcp.restrictCmekCryptoKeyProjects 限制条件。
作为列表限制条件,它接受的值是资源层次结构指示符(例如
projects/PROJECT_ID
under:folders/FOLDER_ID 和
under:organizations/ORGANIZATION_ID)。要使用此限制条件,请
配置资源层次结构指示符列表并将限制条件
设置为 允许。此配置会限制支持的服务,以便仅从列出的项目、文件夹和组织中选择 CMEK 密钥。
如果没有来自允许资源之一的 Cloud KMS 密钥,则无法在已配置的服务中成功创建受 CMEK 保护的资源。如果已配置,此限制条件将应用于所有支持的服务
。
支持的服务
| 服务 | 要求 CMEK 时的限制条件值 |
|---|---|
| Agent Assist | dialogflow.googleapis.com |
| Agent Search | discoveryengine.googleapis.com |
| AlloyDB for PostgreSQL | alloydb.googleapis.com |
| Apigee | apigee.googleapis.com |
| Application Integration | integrations.googleapis.com |
| Artifact Registry | artifactregistry.googleapis.com |
| Backup and DR Service | backupdr.googleapis.com |
| Backup for GKE | gkebackup.googleapis.com |
| BigQuery | bigquery.googleapis.com |
| Bigtable | bigtable.googleapis.com |
| Cloud Data Fusion | datafusion.googleapis.com |
| Cloud Logging | logging.googleapis.com |
| Cloud Run | run.googleapis.com |
| Cloud Run functions | cloudfunctions.googleapis.com |
| Cloud SQL | sqladmin.googleapis.com |
| Cloud Storage | storage.googleapis.com |
| Cloud Tasks | cloudtasks.googleapis.com |
| Cloud TPU | tpu.googleapis.com |
| Cloud Workstations | workstations.googleapis.com |
| Colab Enterprise | aiplatform.googleapis.com |
| Compute Engine | compute.googleapis.com |
| 客户体验分析洞见 | contactcenterinsights.googleapis.com |
| Dataflow | dataflow.googleapis.com |
| Dataform | dataform.googleapis.com |
| Dialogflow CX | dialogflow.googleapis.com |
| Document AI | documentai.googleapis.com |
| Eventarc Advanced(预览版) | eventarc.googleapis.com |
| Eventarc Standard | eventarc.googleapis.com |
| Filestore | file.googleapis.com |
| Firestore | firestore.googleapis.com |
| Gemini Enterprise | discoveryengine.googleapis.com |
| Google Cloud Managed Lustre | lustre.googleapis.com |
| Google Cloud NetApp Volumes | netapp.googleapis.com |
| Google Cloud Observability(预览版) | observability.googleapis.com |
| Google Kubernetes Engine(预览版) | container.googleapis.com |
| Google Security Operations | chronicleservicemanager.googleapis.com |
| Knowledge Catalog | dataplex.googleapis.com |
| Looker (Google Cloud Core) | looker.googleapis.com |
| Managed Service for Apache Airflow | composer.googleapis.com |
| Managed Service for Apache Spark | dataproc.googleapis.com |
| Memorystore for Redis | redis.googleapis.com |
| Memorystore for Redis Cluster | redis.googleapis.com |
| Memorystore for Valkey | memorystore.googleapis.com |
| Pub/Sub | pubsub.googleapis.com |
| Secret Manager | secretmanager.googleapis.com |
| Secure Source Manager | securesourcemanager.googleapis.com |
| Security Command Center | securitycenter.googleapis.com |
| Spanner | spanner.googleapis.com |
| Speech-to-Text | speech.googleapis.com |
| Vertex AI | aiplatform.googleapis.com |
| Vertex AI Workbench 实例 | notebooks.googleapis.com |
CMEK 组织政策和 Storage Transfer Service
Storage Transfer Service 没有 CMEK 集成,但可以与 CMEK 组织政策搭配使用。如果您使用 Storage Transfer Service 并且想要使用 CMEK 来帮助保护存储在 Secret Manager 中的数据库凭据,则必须将 storagetransfer.googleapis.com 和 secretmanager.googleapis.com 都添加到 constraints/gcp.restrictNonCmekServices 限制条件中。如需了解详情,请参阅 Storage Transfer Service CMEK
文档。
按资源类型划分的强制执行例外情况
在创建新资源或更改现有资源上的 Cloud KMS 密钥(如果支持)时,系统会强制执行 CMEK 组织政策限制条件。一般来说,系统会根据资源配置,对支持 CMEK 的服务的所有资源类型强制执行这些限制条件。下面总结了一些值得注意的例外情况:
| 资源类型 | 强制执行例外情况 |
|---|---|
bigquery.googleapis.com/Dataset |
部分强制执行数据集默认 Cloud KMS 密钥 (gcp.restrictCmekCryptoKeyProjects only)
|
bigquery.googleapis.com/Job |
仅限查询作业:对查询提供的 Cloud KMS 密钥 或结算项目的默认 Cloud KMS 密钥强制执行;另请参阅项目 默认 Cloud KMS 密钥 的单独配置 |
bigquerydatatransfer.googleapis.com/TransferConfig |
转移配置使用 Data Transfer Service 的服务名称 (bigquerydatatransfer.googleapis.com) 作为 CMEK 组织政策限制条件。 |
container.googleapis.com/Cluster |
(预览版)仅对节点启动磁盘的 Cloud KMS 密钥强制执行;不对应用层级的密文强制执行 |
logging.googleapis.com/LogBucket |
对明确创建的日志存储分区强制执行;另请参阅确保内置日志存储分区合规性所需的单独配置 ,以确保内置日志存储分区合规 |
storage.googleapis.com/Bucket |
对存储桶默认 Cloud KMS 密钥强制执行 |
storage.googleapis.com/Object |
独立于存储桶强制执行;另请参阅存储桶默认 Cloud KMS 密钥的单独 配置 |
配置示例
在配置示例中,假设示例组织具有以下资源层次结构:

要求 CMEK 并限制项目的密钥
假设您想要为 projects/5 下的所有 Cloud Storage 资源要求 CMEK 保护,并确保只能使用来自 projects/4 的密钥。
如需为所有新的 Cloud Storage 资源要求 CMEK 保护,请使用以下组织政策设置:
- 组织政策:
constraints/gcp.restrictNonCmekServices - 绑定位置:
projects/5 - 政策类型:拒绝
- 政策值:
storage.googleapis.com
如需确保仅使用来自 projects/4 的密钥,请使用以下配置:
- 组织政策:
constraints/gcp.restrictCmekCryptoKeyProjects - 绑定位置:
projects/5 - 政策类型:允许
- 政策值:
projects/4
要求 CMEK 并将密钥限制在文件夹内
或者,假设您预计将来会在 folders/2 下添加其他 Cloud KMS 项目,并希望在 folders/3 中更广泛地要求 CMEK。对于这种情况,您需要略有不同的配置。
如需为 folders/3 下的任何位置的新 Cloud SQL 和 Cloud Storage 资源要求额外的 CMEK 保护:
- 组织政策:
constraints/gcp.restrictNonCmekServices - 绑定位置:
folders/3 - 政策类型:拒绝
- 政策值:
sqladmin.googleapis.com、storage.googleapis.com
如需确保仅使用来自 folders/2 下的 Cloud KMS 项目的密钥:
- 组织政策:
constraints/gcp.restrictCmekCryptoKeyProjects - 绑定位置:
folders/3 - 政策类型:允许
- 政策值:
under:folders/2
为组织要求 CMEK
如需在组织中的所有位置(在支持的服务中)要求 CMEK,请使用以下设置配置 constraints/gcp.restrictNonCmekServices 限制条件:
- 组织政策:
constraints/gcp.restrictNonCmekServices - 绑定位置:
organizations/1 - 政策类型:拒绝
- 政策值:(所有支持的服务)
限制
如果您使用 Google Cloud 控制台创建资源,您可能会注意到,当为项目和服务配置
constraints/gcp.restrictNonCmekServices时,您无法使用 CMEK 以外的任何加密选项。只有在客户账号被授予项目的 orgpolicy.policy.get IAM 权限后,CMEK 组织政策限制才会显示。
后续步骤
如需详细了解组织政策的优势和常见用例,请参阅组织政策 服务简介 。
如需查看有关创建具有特定 限制条件的组织政策的更多示例,请参阅使用 限制条件。