您可以使用GCP KMS中的客户托管密钥 (CMK) 进一步加密Atlas中的静态数据。
注意
The MongoDB Atlas Shared Responsibility Model defines the complementary duties of MongoDB and its customers in maintaining a secure and resilient data environment. Under this framework, MongoDB manages the security and operational integrity of the underlying platform, while customers are responsible for the configuration, management, and data policies of their specific deployments. For a detailed breakdown of ownership across security and operational excellence, see Shared Responsibility Model.
Atlas uses your CMK from Google Cloud KMS to encrypt and decrypt MongoDB Master Keys, which are then used to encrypt cluster database files and cloud providers snapshots. To learn more about how Atlas uses CMKs for encryption, see Enable Customer-Managed Keys with Google Cloud KMS.
当您使用自己的云提供商 KMS 时,Atlas 会自动轮换 MongoDB 主密钥,至少每 90 天。如果您已配置维护窗口,您的密钥轮换将在 维护窗口 期间开始。推迟维护(手动或自动)可能会导致密钥轮换超过 90 天的时间限制。密钥滚动轮换,并且该过程不需要重写数据。
注意
Atlas Infinite
Google Cloud KMS isn't available for Atlas Infinite during public preview. Atlas Infinite supports customer-managed keys only through AWS KMS during public preview. To learn how encryption at rest works for Atlas Infinite, see Atlas Infinite Encryption.
您必须先为 Atlas 项目配置客户密钥管理,然后才能在该项目中的集群上启用它。
使用 Google Cloud KMS 启用客户托管的密钥
Atlas中的客户数密钥管理遵循称为信封加密的进程。此进程通过使用一个密钥加密另一个密钥来创建多层加密。为了启用客户密钥管理, Atlas使用以下加密密钥:
Customer-Managed Key (CMK)Customer-managed keys are encryption keys that you create, own, and manage in Google Cloud KMS. You create the CMK in Google Cloud KMS and connect it to Atlas at the Project level. To learn more about the CMKs used in Google Cloud KMS, see Google Cloud Documentation.
Atlas 仅使用此密钥来加密 MongoDB 主密钥。
MongoDB Master KeyAtlas 集群中的每个节点都会创建一个MongoDB主密钥。 MongoDB主密钥是MongoDB Server用于加密每数据库加密密钥的加密密钥。 Atlas在本地保存密钥的加密副本。
此密钥使用 CMK 加密,并对每个数据库的加密密钥进行加密。
Per-Database Encryption KeyAtlas 集群中的每个节点还会为集群中的每个数据库创建一个加密密钥。Atlas 使用这些密钥,通过 WiredTiger 读取和写入数据,WiredTiger 还对这些密钥进行加密和存储。
此密钥使用 MongoDB 主密钥加密。
例子
请考虑以下针对三节点副本集的加密层次结构。 Atlas使用 GCPKMS中的 CMKMongoDB 为集群中的每个节点加密唯一的 主密钥。每个节点还包含三个数据库,每个数据库都使用每个数据库唯一的加密密钥进行加密。 当集群启动时,Atlas MongoDB使用 中的 CMK 解密GCPKMS 主密钥,并将其提供给MongoDB Server 。
注意
如果您撤销 Atlas 对客户主密钥的访问权限,Atlas 就会关闭集群中的节点,并且在您恢复对客户主密钥的访问权限之前,您无法访问数据。

必需的访问权限
要配置客户密钥管理,您必须拥有对项目的 Project Owner 访问权限。
拥有 Organization Owner 访问权限的用户必须将自己作为 Project Owner 添加到项目中。
先决条件
要使用 Google Cloud KMS 为 MongoDB 项目启用客户托管密钥,您必须具备:
- 使用 M10 或更大的集群。
您的 Google 云服务账号密钥。
Google Cloud KMS 中的对称加密密钥。
与您的 Google Cloud KMS 加密密钥关联的密钥版本资源 ID。
一个 Google Cloud 服务帐户,该帐户具有服务帐户密钥所指定的凭据,并具有足够权限执行以下操作:
获取 Google Cloud KMS 加密密钥版本。
使用 Google Cloud KMS 加密密钥版本加密数据。
使用 Google Cloud KMS 加密密钥解密数据。
注意
处理解密的是密钥,而不是密钥版本。
如果您的 Google Cloud KMS 配置有此要求,请为 Atlas IP 地址 以及集群节点的公共 IP 地址或 DNS 主机名创建 GCP 访问级别 ,以便 Atlas 可以与您的 KMS 通信。如果节点 IP 地址发生变化,必须更新配置以避免连接中断。
为项目启用客户托管密钥
您必须先为项目启用客户密钥管理,然后才能在该项目中的集群上进行启用。
AtlasGoAdvanced在Atlas中,Go项目的 页面。
如果尚未显示,请从导航栏上的 Organizations 菜单中选择包含项目的组织。
如果尚未显示,请从导航栏的 Projects 菜单中选择您的项目。
在侧边栏中,单击 Security 标题下的 Database & Network Access。
在侧边栏中,单击 Advanced。
显示“高级”页面。
输入 Key Version Resource ID(密钥保管库凭证)。
输入您要用于静态数据的Google Cloud Platform KMS密钥的密钥版本资源ID 。
密钥版本资源ID是 CryptoKeyVersion 的完全限定资源名称。
重要
您必须先输入有效的ID ,然后才能配置身份验证方法。
配置身份验证方法。
Atlas支持GCP KMS的两种身份验证方法:
服务帐号(推荐):使用 Atlas 托管的特定于您的项目的服务帐号向GCP进行身份验证。
静态档案:提供客户托管服务帐户密钥。
为了以安全的方式授予访问权限,Atlas使用特定于Atlas项目的服务帐户对GCP进行身份验证。然后,您可以向服务帐户分配策略,以控制对项目资源的访问权限。
注意
如果您之前使用静态凭证配置了静态加密,现在要迁移到基于服务帐户的身份验证,请注意,此迁移是严格单向的。Atlas不支持恢复为静态档案身份验证方法。
如果您有一个现有的Atlas GCP服务帐户,并且已配置所需权限,请从 Connect Service Account 下拉菜单中选择该帐户。否则,请完成以下步骤:
单击 Authorize a new service account。出现 Encrypt Data with GCP KMS 对话框。
如果您尚未为您的 Atlas 项目设置服务账号,请点击 Set Up 按钮来创建您的 GCP 资源。Atlas 预配 GCP 文件夹 并创建服务账号。创建服务账号需要该文件夹。如果您已有适用于 Atlas 项目的服务账号,请跳过此步骤。
从下拉菜单中选择Atlas服务帐户或创建一个新帐户。
运行显示的gcloud命令,向服务帐号授予以下所需权限:
Enable Encrypt/Decrypt operations
gcloud kms keys add-iam-policy-binding \ <key-name> \ --location <location> \ --keyring <keyring-name> \ --member <ATLAS_OWNED_SERVICE_ACCOUNT_EMAIL> \ --role="roles/cloudkms.cryptoKeyEncrypterDecrypter" Enable GetPublicKey operations
gcloud kms keys add-iam-policy-binding \ <key-name> \ --location <location> \ --keyring <keyring-name> \ --member <ATLAS_OWNED_SERVICE_ACCOUNT_EMAIL> \ --role="roles/cloudkms.viewer"
单击 Validate & Finish 进行确认。
您可以通过将 Authorize with static credentials 切换为 On 来手动指定服务帐户密钥。然后,在文本框中输入JSON对象格式的密钥以及GCP服务帐户的加密凭证。
重要
未来发布将弃用静态凭证。尽可能对新项目使用服务帐户身份验证。使用静态凭证的现有项目可以继续使用它们,但一旦迁移到服务帐户身份验证就无法切换回来。
为 Atlas 集群启用客户密钥管理
After you Enable Customer-Managed Keys for a Project, you must enable customer key management for each Atlas cluster that contains data that you want to encrypt.
注意
您必须拥有 Project Owner 角色才能为该项目中的集群启用客户密钥管理。
对于新集群,请在创建集群时将管理自己的加密密钥设置切换为 Yes(是)。
对于现有群组:
AtlasGoClusters在Atlas中,Go项目的 页面。
如果尚未显示,请从导航栏上的 Organizations 菜单中选择包含所需项目的组织。
如果尚未显示,请从导航栏的Projects菜单中选择所需的项目。
在侧边栏中,单击 Database 标题下的 Clusters。
会显示集群页面。
警报
Atlas automatically creates an encryption key rotation alert once you configure customer key management for a project. You can reset this alert at any time by rotating your GCP Key Version Resource ID.
轮换您的 GCP 密钥版本资源 ID
MongoDB 主密钥 - MongoDB 责任
当您使用自己的云提供商 KMS 时,Atlas 会自动轮换 MongoDB 主密钥,至少每 90 天。如果您已配置维护窗口,您的密钥轮换将在 维护窗口 期间开始。推迟维护(手动或自动)可能会导致密钥轮换超过 90 天的时间限制。密钥滚动轮换,并且该过程不需要重写数据。
Google Cloud CMK - 您的责任
Atlas 不会自动轮换用于 Google Cloud 密钥管理的密钥版本资源 ID。
As a best practice, Atlas creates an alert to remind you to rotate your GCP Key Version Resource ID every 90 days by default when you enable Encryption at Rest for the Atlas project. You can configure the time period of this alert.
You can rotate your Google Cloud CMK yourself or configure your Google Cloud KMS instance to automatically rotate your CMK. If you configure automatic Google Cloud CMK rotation, the default time period for rotation is approximately 365 days.
如果您已在 Google Cloud 中设置了自动 客户主密钥 轮换,并不希望收到每 90 天轮换一次 客户主密钥 的 Atlas 警报,则可以将默认警报期限修改为大于 365 天。
先决条件
您必须在与 Atlas 项目关联的 Google Cloud 帐户中创建新的服务帐户密钥。
步骤
以下过程介绍如何通过在 Atlas 中指定新的密钥版本资源 ID 来轮换 Atlas 项目密钥标识符。
AtlasGoAdvanced在Atlas中,Go项目的 页面。
如果尚未显示,请从导航栏上的 Organizations 菜单中选择包含项目的组织。
如果尚未显示,请从导航栏的 Projects 菜单中选择您的项目。
在侧边栏中,单击 Security 标题下的 Database & Network Access。
在侧边栏中,单击 Advanced。
显示“高级”页面。
更新 GCP 密钥详情。
如果 Google Cloud KMS 标签页尚未激活,请单击 Google Cloud KMS。
如果尚未显示 Encryption Key Credentials 对话框,则展开 Encryption Key Credentials 。
在 Key Identifier 条目中输入 GCP 密钥版本资源 ID。
包括CryptoKeyVersion。的完全限定资源名称。
例子
projects/my-project-0/locations/us-east4/keyRings/my-key-ring-0/cryptoKeys/my-key-0/cryptoKeyVersions/1 加密密钥必须属于为您的 Atlas 项目配置的 Google Cloud Service 帐户密钥。单击 Service Account Key 部分查看当前为项目配置的服务帐户密钥。
单击 Update Credentials(连接)。
在密钥标识符轮换过程中,Atlas 在 Atlas 控制台中显示横幅。
警告
在部署更改之前,请勿删除或禁用原始密钥版本资源 ID。
如果集群使用备份集群,在您验证没有快照使用过原始密钥版本资源 ID 进行加密之前,请勿删除或禁用原始密钥版本资源 ID。
警报
此过程完成后,Atlas 会重置 encryption key rotation alert 计时器。
为搜索节点启用客户管理的密钥
By default, MongoDB and search processes run on the same nodes. With this architecture, customer-managed encryption applies to your database data, but it does not apply to search indexes.
启用专用搜索节点后,搜索进程将在单独的节点上运行。这允许您启用搜索节点数据加密,以便您可以使用相同的客户托管密钥对数据库数据和搜索索引进行加密,以实现全面的加密覆盖范围。
在公开预览期间,Atlas Infinite 集群集群不支持专用搜索节点。
注意
Database nodes and Search Nodes use different encryption methods with the same customer-managed keys. Database nodes use the WiredTiger Encrypted Storage Engine, while Search Nodes use encryption at the disk level.
重要
KMS 提供商均提供此功能。
相关主题
如需在部署 Atlas 集群时使用“密钥管理”启用“静态加密”,请参阅“管理加密密钥”。
如需使用“密钥管理”对现有 Atlas 集群启用“静态加密”,请参阅“启用静态加密”。
如需进一步了解如何在 Atlas 中使用“密钥管理”进行静态加密,请参阅“使用客户密钥管理进行静态加密”。
To learn more about MongoDB Encryption at Rest, see Encryption at Rest in the MongoDB server documentation.
要了解有关使用云备份进行静态加密的更多信息,请参阅存储引擎和云备份加密。