创建数据库用户,以向客户端提供对项目中集群的访问权限。
注意
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.
A database user's access is determined by the roles assigned to the user. When you create a database user, any of the built-in roles add the user to all clusters in your Atlas project. To specify which resources a database user can access in your project, you can select the option Restrict Access to Specific Clusters in the Atlas UI or set specific privileges and custom roles.
数据库用户与 Atlas 用户是分开的。数据库用户 可访问 MongoDB 数据库,而 Atlas 用户可访问 Atlas 应用程序本身。 Atlas 支持创建临时数据库用户, 这些用户会在用户可配置的 7 天期限内自动过期。
Atlas审核项目操作日志中临时和非临时数据库用户的创建、删除和更新操作。
限制
以下限制仅适用于 MongoDB Atlas 中托管的部署。如果其中任何限制对您的组织造成问题,请联系 Atlas 支持部门。
您必须使用Atlas CLI、Atlas Administration API、Atlas 用户界面或支持的集成来管理Atlas集群上的数据库用户。否则,Atlas会回滚任何用户修改。
可用的Atlas内置角色和特定权限支持MongoDB命令的子集。有关详细信息,请参阅 M10 + 集群中不支持的命令。
每个Atlas项目最多可以创建 100 个数据库用户。
数据库用户身份验证方法
Atlas 为数据库用户提供以下形式的身份验证:
密码: SCRAM 是 MongoDB 的默认身份验证方法。SCRAM 要求为每个用户设置密码。
The authentication database for SCRAM-authenticated users is the
admindatabase.注意
默认下,Atlas支持SCRAM-SHA-256身份验证。如果您在MongoDB 4.0 之前创建用户,则必须更新MongoDB 4.0,更新其密码以生成SCRAM-SHA-256凭证。您可以重复使用现有密码。
何时使用SCRAM:
您可以对人类用户和应用程序用户使用SCRAM身份验证。对于较低的环境, SCRAM是一种合适的身份验证方法。对于生产和更高层环境,请遵循安全最佳实践以确保密钥安全且短期有效,例如与特权访问管理 (PAM) 解决方案集成。
X.509 证书: X.509 证书也称为双向 TLS 或 mTLS,允许使用受信任的证书进行无密码身份验证。
经过 X. 身份验证的用户的身份验证数据库是509
$external数据库。如果启用LDAP授权,则使用 Atlas 托管的 X.509 证书进行身份验证的用户将无法连接到集群。要启用LDAP并使用 X.509 用户连接到集群,请参阅设置自管理的 X.509 证书。
何时使用 X.509:
当工作负载身份联合 (OIDC) 或 AWS IAM身份验证不可行或需要相互身份验证时,X.509身份验证适用于安全工作负载访问权限。
OIDC:OpenID Connect (OIDC)身份验证支持使用外部身份提供程序进行无密码、无秘密的身份验证。Atlas支持以下类型的 OIDC身份验证:
Workforce Identity Federation for human principals such as employees, partners, and contractors.
Workload Identity Federation for applications using external programmatic identities such as Azure Service Principals, Azure Managed Identities, and Google Service Accounts.
The authentication database for OIDC-authenticated users is the
$externaldatabase.OIDC身份验证仅适用于使用MongoDB 7.0 及更高版本的集群。
何时使用 OIDC:
对于人类用户,我们建议您将 Workforce Identity Federation 与 OIDC 结合使用。
对于应用程序用户,对于在GCP或Azure上运行的应用程序,我们建议您将 Workload Identity Federation 与 OIDC 结合使用。
AWS IAM: You can create a database user which uses an AWS IAM User or Role ARN for authentication.
The authentication database for AWS IAM-authenticated users is the
$externaldatabase.何时使用 AWS IAM:
我们建议您对 AWS 上运行的应用程序用户使用具有 IAM 角色的 AWS IAM身份验证。
必需的访问权限
要添加数据库用户,您必须拥有Organization Owner、Organization Stream Processing Admin、Project Owner、Project Stream Processing Owner 或 Project Database Access Admin访问权限。