Last updated: 2021-09-29
This document provides a list of security measures that you should implement to protect your MongoDB installation. 本文档提供了保护MongoDB安装的安全措施列表。The list is not meant to be exhaustive.这份清单并非详尽无遗。
Enable access control and specify an authentication mechanism.启用访问控制并指定身份验证机制。
MongoDB Community supports a number of authentication mechanisms that clients can use to verify their identity:MongoDB社区支持许多身份验证机制,客户端可以使用这些机制来验证其身份:
In addition to the preceding mechanisms, MongoDB Atlas and MongoDB Enterprise support the following mechanisms:除上述机制外,MongoDB Atlas和MongoDB Enterprise还支持以下机制:
These mechanisms allow MongoDB to integrate into your existing authentication system.这些机制允许MongoDB集成到现有的身份验证系统中。
Follow the principle of least privilege. 遵循最低权限原则。Create roles that define the exact access rights required by a set of users. 创建定义一组用户所需的确切访问权限的角色。Then create users and assign them only the roles they need to perform their operations. 然后创建用户并仅为其分配执行操作所需的角色。A user can be a person or a client application.用户可以是个人或客户端应用程序。
A user can have privileges across different databases. 用户可以拥有跨不同数据库的权限。If a user requires privileges on multiple databases, create a single user with roles that grant applicable database privileges instead of creating the user multiple times in different databases.如果用户需要对多个数据库的权限,请创建具有授予适用数据库权限的角色的单个用户,而不是在不同的数据库中多次创建该用户。
Configure MongoDB to use TLS/SSL for all incoming and outgoing connections. 将MongoDB配置为对所有传入和传出连接使用TLS/SSL。Use TLS/SSL to encrypt communication between 使用TLS/SSL加密MongoDB部署的mongod
and mongos
components of a MongoDB deployment as well as between all applications and MongoDB.mongod
和mongos
组件之间以及所有应用程序和MongoDB之间的通信。
MongoDB uses the native TLS/SSL OS libraries:MongoDB使用本机TLS/SSL操作系统库:
Platform | TLS/SSL Library |
---|---|
Windows | Secure Channel (Schannel) |
Linux/BSD | OpenSSL |
macOS | Secure Transport |
net.bindIp
configuration settingnet.bindIp
配置设置security.clusterIpSourceAllowlist
configuration settingsecurity.clusterIpSourceAllowlist
配置设置db.createUser()
command to specify a per-user IP allow list.db.createUser()
命令的authenticationRestrictions
字段用于指定每个用户的IP允许列表。mapReduce
, $where
, $accumulator
, and $function
. mapReduce
、$where
、$accumulator
和$function
。--noscripting
option.--noscripting
选项禁用服务器端脚本。net.wireObjectCheck
setting. net.wireObjectCheck
设置启用输入验证。mongod
instance are valid BSON.mongod
实例存储的所有文档都是有效的BSON。Ensure that your information security management system policies and procedures extend to your MongoDB installation, including performing the following:确保您的信息安全管理系统策略和过程扩展到您的MongoDB安装,包括执行以下操作: