MongoDB-CN-Manual
  • MongoDB中文手册|官方文档中文版
  • MongoDB用户手册说明
  • MongoDB简介
    • 入门
    • 数据库和集合
      • 视图
      • 按需物化视图
      • 封顶集合
      • 时间序列集合
    • 文档
    • BSON类型
      • Comparison and Sort Order
      • MongoDB Extended JSON (v2)
      • MongoDB Extended JSON (v1)
  • 安装 MongoDB
    • 安装MongoDB社区版
      • 在Linux上安装MongoDB社区版
      • 在macOS上安装MongoDB社区版
      • 在Windows上安装MongoDB社区版
    • 安装MongoDB企业版
      • 在Linux上安装MongoDB企业版
      • 在Mac OS安装MongoDB企业版
      • 在Windows安装MongoDB企业版
      • 使用Docker安装MongoDB企业版
    • 将社区版MongoDB升级到企业版MongoDB
    • 验证MongoDB软件包的完整性
  • The mongo Shell
    • 配置mongo Shell
    • 使用 mongo Shell帮助
    • 为mongo Shell编写脚本
    • mongo Shell中的数据类型
    • mongo Shell 快速参考
  • MongoDB CRUD操作
    • 插入文档
      • 插入方法
    • 查询文档
      • 在mongo Shell中迭代游标
      • 从查询返回的项目字段
      • 查询嵌入式文档数组
      • 查询数组
      • 查询空字段或缺少字段
      • 查询嵌入/嵌套文档
    • 更新文档
      • 更新方法
      • 聚合管道更新
    • 删除文档
      • 删除方法
    • 地理空间查询
      • 用地理空间查询查找餐馆
      • GeoJSON对象
    • 批量写入操作
    • 可重试写入
    • 可重试读取
    • SQL到MongoDB的映射图表
    • 文本搜索
      • 文本索引
      • 文本索引操作
      • 集合管道中的文本索引
      • 文本索引语言
    • Read Concern读关注
      • 读关注 "local"
      • 读关注 "available"
      • 读关注 "majority"
      • 读关注 "linearizable"
      • 读关注 "snapshot"
    • Write Concern写关注
    • MongoDB CRUD概念
      • 原子性和事务
      • 读隔离性,一致性和近因性
        • 因果一致性和读写关注
      • 分布式查询
      • 通过findAndModify进行线性化读取
      • 查询计划
      • 查询优化
        • 评估当前操作性能
        • 优化查询性能
        • 写操作性能
        • 说明结果
      • 分析查询表现
      • Tailable 游标
  • MongoDB聚合
    • 聚合管道
      • 聚合管道优化
      • 聚合管道限制
      • 聚合管道和分片集合
      • 使用 Zip Code 数据集进行聚合
      • 使用用户首选项数据进行聚合
    • Map-Reduce
      • Map-Reduce 和分片集合
      • Map-Reduce 并发
      • Map-Reduce 示例
      • 执行增量 Map-Reduce
      • 对 Map Function 进行故障排除
      • 排除 Reduce Function 问题
      • Map-Reduce转换到聚合管道
    • 聚合参考
      • 聚合管道快速参考
      • 聚合命令
      • 聚合命令对比
      • 聚合表达式中的变量
      • SQL 到聚合映射图表
  • MongoDB数据模型
    • 数据建模介绍
    • 模式验证
    • 数据模型设计
      • 一对一嵌套关系模型
  • MongoDB事务
  • MongoDB事务
    • 驱动程序 API
    • 生产注意事项
    • 生产注意事项 (分片集群)
    • 事务操作
  • MongoDB索引
    • 单字段索引
    • 复合索引
    • 多键索引
      • 多键索引范围
    • 文本索引
      • 为文本索引指定语言
      • 指定文本索引的名称
      • 用权重控制搜索结果
      • 限制扫描条目的数量
    • 通配符索引
      • 通配符索引限制
    • 2dsphere 索引
      • 查询一个2dsphere索引
    • 2d 索引
      • 创建一个2d索引
      • 查询一个2d索引
      • 2d索引内部
      • 使用球面几何计算距离
    • geoHaystack 索引
      • 创建Haystack索引
      • 查询Haystack索引
    • 哈希索引
    • 索引特性
      • TTL 索引
        • 通过设置TTL使集合中的数据过期
      • 唯一索引
      • 部分索引
      • 不分大小写索引
      • Sparse 索引
    • 在填充的集合上建立索引
      • 在副本集上建立滚动索引
      • 在分片群集上建立滚动索引
    • 索引交集
    • 管理索引
    • 衡量索引使用
    • 索引策略
      • 创建索引来支持查询
      • 使用索引对查询结果进行排序
      • 确保索引适合RAM
      • 创建以确保选择性的查询
    • 索引参考
  • MongoDB安全
    • 安全检查列表
    • 启用访问控制
    • 身份验证
      • 用户
        • 添加用户
        • 权限认证机制
          • SCRAM
            • 用x.509证书来认证客户端
    • 审计
      • 配置审计过滤器
      • 配置审计
      • 系统事件审计消息
    • 网络和配置强化
    • 安全参考
      • system.roles集合
      • system.users集合
      • 资源文档
      • 权限操作
    • 附录
      • 附录-A-用于测试的 OpenSSl CA 证书
      • 附录-B-用于测试的OpenSSL服务器证书
      • 附录-C-用于测试的OpenSSL客户端证书
  • Change Streams变更流
    • 变更流生产建议
    • 变更事件
  • MongoDB复制
    • 副本集成员
    • 副本集日志
    • 副本集数据同步
    • 副本集部署架构
    • 副本集成员配置教程
    • 副本集维护教程
    • MongoDB复制参考
  • MongoDB分片
    • 分片集群组件
    • 分片键
    • 哈希分片
    • 范围分片
    • 区
      • 管理分片区
      • 按位置细分数据
      • 用于更改SLA或SLO的分层硬件
      • 按应用或客户细分数据
      • 仅插入工作负载的分布式本地写入
      • 管理分片区
    • 使用块进行数据分区
      • 在分片集群中拆分数据块
    • 分片管理
      • 查看集群设置
    • 重启一个分片集群
    • [把一个分片集群迁移到不同的硬件](fen-pian/migrate-a -sharded-cluster-to-different-hardware.md)
    • 分片参考
  • MongoDB管理
    • 产品说明
    • 操作检查列表
    • 开发检查列表
    • 配置和维护
    • 性能
    • 数据中心意识
      • MongoDB部署中的工作负载隔离
      • 区
        • 管理分片区
        • 按位置细分数据
        • 用于更改SLA或SLO的分层硬件
        • 按应用或客户细分数据
        • 仅插入工作负载的分布式本地写入
        • 管理分片区
    • MongoDB备份方法
    • MongoDB监控
  • MongoDB存储
    • 存储引擎
      • WiredTiger 存储引擎
      • 内存存储引擎
    • 日志记录
      • 管理日志记录
        • GridFS
        • FAQ:MongoDB 存储
  • MongoDB参考
    • 运算符
      • 查询与映射运算符
        • 比较查询运算符
          • $eq
          • $gt
          • $gte
          • $in
          • $lt
          • $lte
          • $ne
          • $nin
        • 逻辑查询运算符
          • $and
          • $not
          • $nor
          • $or
        • 元素查询运算符
        • 评估查询运算符
        • 地理空间查询运算符
        • 数组查询运算符
        • 按位查询运算符
        • $comment
        • 映射运算符
      • 更新运算符
        • 字段更新运算符
        • 数组更新运算符
        • 按位更新运算符
      • 聚合管道阶段
      • 聚合管道操作符
        • $abs (aggregation)
        • $acos (aggregation)
        • $acosh (aggregation)
        • $add (aggregation)
        • $addToSet (aggregation)
        • $allElementsTrue (aggregation)
        • $and (aggregation)
        • $anyElementTrue (aggregation)
        • $arrayElemAt (aggregation)
        • $arrayToObject (aggregation)
        • $asin (aggregation)
        • $asinh (aggregation)
        • $atan (aggregation)
        • $atan2 (aggregation)
        • $atanh (aggregation)
        • $avg (aggregation)
        • $ceil (aggregation)
        • $cmp (aggregation)
        • $concat (aggregation)
        • $concatArrays (aggregation)
        • $cond (aggregation)
        • $convert (aggregation)
        • $cos (aggregation)
        • $dateFromParts (aggregation)
        • $dateToParts (aggregation)
        • $dateFromString (aggregation)
        • $literal (aggregation)
      • 查询修饰符
    • 数据库命令
      • 聚合命令
      • 地理空间命令
      • 查询和写操作命令
      • 查询计划缓存命令
      • 认证命令
      • 用户管理命令
      • 角色管理命令
      • 复制命令
      • 分片命令
      • 会话命令
      • 管理命令
      • 诊断命令
      • 免费监控命令
      • 系统事件审计命令
    • mongo Shell 方法
      • 集合方法
        • db.collection.aggregate()
        • db.collection.bulkWrite()
        • db.collection.copyTo()
        • db.collection.count()
        • db.collection.countDocuments()
        • db.collection.estimatedDocumentCount()
        • db.collection.createIndex()
        • db.collection.createIndexes()
        • db.collection.dataSize()
        • db.collection.deleteOne()
        • db.collection.deleteMany()
        • db.collection.distinct()
        • db.collection.drop()
        • db.collection.dropIndex()
        • db.collection.dropIndexes()
        • db.collection.ensureIndex()
        • db.collection.explain()
        • db.collection.find()
        • db.collection.findAndModify()
        • db.collection.findOne()
        • db.collection.findOneAndDelete()
        • db.collection.findOneAndReplace()
        • db.collection.findOneAndUpdate()
        • db.collection.getIndexes()
        • db.collection.getShardDistribution()
        • db.collection.getShardVersion()
        • db.collection.insert()
        • db.collection.insertOne()
        • db.collection.insertMany()
        • db.collection.isCapped()
        • db.collection.latencyStats()
        • db.collection.mapReduce()
        • db.collection.reIndex()
        • db.collection.remove()
        • db.collection.renameCollection()
        • db.collection.replaceOne()
        • db.collection.save()
        • db.collection.stats()
        • db.collection.storageSize()
        • db.collection.totalIndexSize()
        • db.collection.totalSize()
        • db.collection.update()
        • db.collection.updateOne()
        • db.collection.updateMany()
        • db.collection.watch()
        • db.collection.validate()
    • MongoDB中的限制与阈值
    • MongoDB系统集合
    • 词汇表
    • 默认的MongoDB端口
    • 默认的MongoDB读/写关注
    • 服务器会话
  • MongoDB FAQ
    • FAQ: MongoDB基础知识
    • FAQ: MongoDB索引
    • FAQ: MongoDB并发
    • FAQ: MongoDB分片
    • FAQ: MongoDB复制和副本集
    • FAQ: MongoDB存储
    • FAQ: MongoDB诊断
  • MongoDB 版本管理
  • 联系我们
    • Tapdata Cloud
    • MongoDB中文社区
    • 社区合作伙伴—锦木信息
由 GitBook 提供支持
在本页
  • Use x.509 Certificates to Authenticate Clients
  • 用x.509证书来认证客户端
  • Prerequisites
  • 规程
  • Procedures
  • 流程
  1. MongoDB安全
  2. 身份验证
  3. 用户
  4. 权限认证机制
  5. SCRAM

用x.509证书来认证客户端

上一页SCRAM下一页审计

最后更新于3年前

Use x.509 Certificates to Authenticate Clients

用x.509证书来认证客户端

On this page

此页面

NOTE

Starting in version 4.0, MongoDB disables support for TLS 1.0 encryption on systems where TLS 1.1+ is available. For more details, see .

MongoDB supports x.509 certificate authentication for use with a secure . The x.509 client authentication allows rather than with a username and password. The following tutorial outlines the steps to use x.509 for client authentication with a standalone instance.

To use x.509 authentication for replica sets or sharded clusters, see .

注意 从4.0版本开始,MongoDB不在支持TLS1.0加密,而TLS 1.1+可用,更多细节,请参见 。 MongoDB支持使用安全的 进行x.509证书身份验证。x.509客户端身份验证允许 ,而不是使用用户名和密码。下面的教程逐步展示了x.509客户端认证步骤,使用单 实例。 使用x.509认证复制集及分片集群,详细见

Prerequisites

IMPORTANT

A full description of TLS/SSL, PKI (Public Key Infrastructure) certificates, in particular x.509 certificates, and Certificate Authority is beyond the scope of this document. This tutorial assumes prior knowledge of TLS/SSL as well as access to valid x.509 certificates.

规程

重要 对TLS/SSL、PKI(公钥基础设施)证书,特别是x.509证书和凭证管理中心完整描述超出了本文档的范围。本教程假设您已经了解TLS/SSL,并且能够使用有效的x.509证书。

Certificate Authority

For production use, your MongoDB deployment should use valid certificates generated and signed by a single certificate authority. You or your organization can generate and maintain an independent certificate authority, or use certificates generated by a third-party TLS/SSL vendor. Obtaining and managing certificates is beyond the scope of this documentation.

IMPORTANT

To use x.509 authentication, --tlsCAFile or net.tls.CAFile must be specified unless using --tlsCertificateSelector or --net.tls.certificateSelector. Or if using the ssl aliases, --sslCAFile or net.ssl.CAFile must be specified unless using --sslCertificateSelector or net.ssl.certificateSelector.

凭证管理中心

对于生产环境,您部署的MongoDB应该使用由单个证书颁发机构生成并签名的有效证书。您或者您的组织可以生成和维护一个独立的证书授权,或使用由第三方TLS/SSL供应商生成的证书。获取和管理证书超出了本文档的范围。

重要 要使用x.509身份验证,--tlsCAFile或net.tls.CAFile 必须指定, 除非使用--tlsCertificateSelector 或--net.tls.certificateSelector。或者如果使用ssl 别名,--sslCAFile 或net.ssl.CAFile必须指定,除非使用--sslCertificateSelector 或net.ssl.certificateSelector。

Client x.509 Certificate

NOTE

You must have valid x.509 certificates.

Starting in MongoDB 4.0, if you specify --sslAllowInvalidCertificates or net.ssl.allowInvalidCertificates: true (or in MongoDB 4.2, the alias --tlsAllowInvalidateCertificates or net.tls.allowInvalidCertificates: true) when using x.509 authentication, an invalid certificate is only sufficient to establish a TLS/SSL connection but is insufficient for authentication.

The client certificate must have the following properties:

  • A single Certificate Authority (CA) must issue the certificates for both the client and the server.

  • Client certificates must contain the following fields:

  keyUsage = digitalSignature
  extendedKeyUsage = clientAuth
  • Each unique MongoDB user must have a unique certificate.

  • WARNING

客户端x.509证书

请注意 您必须拥有有效的x.509证书。

从MongoDB 4.0开始,如果你指定--sslAllowInvalidCertificates或net.ssl.allowInvalidCertificates: true (或在MongoDB 4.2中,使用别名的方式,--tlsAllowInvalidateCertificates 或者 net.tls.allowInvalidCertificates: true)。当使用x.509身份验证时,一个无效的证书只足以建立一个TLS/SSL连接,但对于身份验证是_不足_的。 客户端证书必须具有以下属性:

  • 单个证书颁发机构(CA)必须同时为客户端和服务器颁发证书。

  • 客户端证书必须包含以下字段:

    keyUsage = digitalSignature
    extendedKeyUsage = clientAuth
  • 每个唯一的MongoDB用户必须有一个唯一的证书。

MongoDB Deployment Configured for x.509 (Using TLS Options)

NOTE

The tls settings/options provide identical functionality as the ssl options since MongoDB has always supported TLS 1.0 and later.

  • Command-Options

  • Configuration File

mongod --tlsMode requireTLS --tlsCertificateKeyFile <path to TLS/SSL certificate and key PEM file> --tlsCAFile <path to root CA PEM file> --bind_ip <hostnames>

The x.509 configuration requires:

Option
Notes

Specify requireTLS.

The instance’s x.509 certificate to present to clients.

Certificate Authority file to verify the certificates presented to the instance.

在部署的MongoDB上配置x.509(使用TLS选项)

tls设置/选项提供了与ssl选项相同的功能,因为MongoDB一直支持tls 1.0和以后的版本。

  • 命令选项

  • 配置文件

    mongod --tlsMode requireTLS --tlsCertificateKeyFile <path to TLS/SSL certificate and key PEM file> --tlsCAFile <path to root CA PEM file> --bind_ip <hostnames>

x.509配置包含:

选项
说明

指定requireTLS.

提供给客户端的x.509证书 实例

证书权威文件,以验证呈现给实例的证书

MongoDB Deployment Configured for x.509 (Using SSL Options)

NOTE

The tls settings/options provide identical functionality as the ssl options since MongoDB has always supported TLS 1.0 and later.

  • Command-Options

  • Configuration File

mongod --sslMode requireSSL --sslPEMKeyFile <path to TLS/SSL certificate and key PEM file> --sslCAFile <path to root CA PEM file>  --bind_ip <hostnames>

The x.509 configuration for a standalone requires:

Option
Notes

Specify requireSSL.

The instance’s x.509 certificate.

Certificate Authority file to verify the certificate presented to the instance.

在部署的MongoDB上配置x.509(使用SSL选项)

  • 命令选项

  • 配置文件

mongod --sslMode requireSSL --sslPEMKeyFile <path to TLS/SSL certificate and key PEM file> --sslCAFile <path to root CA PEM file>  --bind_ip <hostnames>
选项
说明

指定 requireSSL.

x.509 证书实例

证书权威文件,以验证呈现给实例的证书

Procedures

Add x.509 Certificate subject as a User

To authenticate with a client certificate, you must first add the value of the subject from the client certificate as a MongoDB user to the $external database. Each unique x.509 client certificate corresponds to a single MongoDB user; i.e. you cannot use a single client certificate to authenticate more than one MongoDB user.

Changed in version 3.6.3: To use sessions with $external authentication users (i.e. Kerberos, LDAP, x.509 users), the usernames cannot be greater than 10k bytes.

NOTE

  1. You can retrieve the RFC2253 formatted subject from the client certificate with the following command:

   openssl x509 -in <pathToClientPEM> -inform PEM -subject -nameopt RFC2253

The command returns the subject string as well as certificate:

   subject= CN=myName,OU=myOrgUnit,O=myOrg,L=myLocality,ST=myState,C=myCountry
   -----BEGIN CERTIFICATE-----
   # ...
   -----END CERTIFICATE-----
  1. Add the RFC2253 compliant value of the subject as a user. Omit spaces as needed.

    copycopied

    db.getSiblingDB("$external").runCommand(
      {
        createUser: "CN=myName,OU=myOrgUnit,O=myOrg,L=myLocality,ST=myState,C=myCountry",
        roles: [
             { role: "readWrite", db: "test" },
             { role: "userAdminAnyDatabase", db: "admin" }
        ],
        writeConcern: { w: "majority" , wtimeout: 5000 }
      }
    )

流程

添加x.509证书的subject作为用户

通过客户端证书进行授权,你必须首先从客户端证书添加subject值来作为MongoDB用户,在 $external数据库中,每个x.509客户端证书相当于一个MongoDB用户,例如,你不能用一个客户端证书来认证多个MongoDB用户 _在版本3.6.3中_使用$external身份验证用户(如Kerberos, LDAP, x.509用户)的会话,用户名不能大于10k字节。

你可以通过如下命令,从客户端证书来还原RFC2253格式的subject :

   openssl x509 -in <pathToClientPEM> -inform PEM -subject -nameopt RFC2253

下面命令返回subject字符串以及证书:

   subject= CN=myName,OU=myOrgUnit,O=myOrg,L=myLocality,ST=myState,C=myCountry
   -----BEGIN CERTIFICATE-----
   # ...
   -----END CERTIFICATE-----

Authenticate with a x.509 Certificate (Using tls Options)

NOTE

The tls settings/options provide identical functionality as the ssl options since MongoDB has always supported TLS 1.0 and later.

  • Connect with Authentication

  • Authenticate after Connection

To authenticate during connection:

mongo --tls --tlsCertificateKeyFile <path to client PEM file> --tlsCAFile <path to root CA PEM file>  --authenticationDatabase '$external' --authenticationMechanism MONGODB-X509
Option
Notes

Client’s x.509 file.

Specify '$external'.

Specify MONGODB-X509.

认证x.509证书 (使用tls选项)

tls设置/选项提供了与ssl选项相同的功能,因为MongoDB一直支持tls 1.0和以后的版本。

  • 连接认证

  • 连接后进行认证

在连接时进行身份验证:

mongo --tls --tlsCertificateKeyFile <path to client PEM file> --tlsCAFile <path to root CA PEM file>  --authenticationDatabase '$external' --authenticationMechanism MONGODB-X509
选项
说明

客户端的x.509文件

指定'$external'.

指定MONGODB-X509.

Authenticate with a x.509 Certificate (Using ssl Options)

NOTE

The tls settings/options provide identical functionality as the ssl options since MongoDB has always supported TLS 1.0 and later.

  • Connect with Authentication

  • Authenticate after Connection

To authenticate during connection:

mongo --ssl --sslPEMKeyFile <path to CA signed client PEM file> --sslCAFile <path to root CA PEM file>  --authenticationDatabase '$external' --authenticationMechanism MONGODB-X509
Option
Notes

Client’s x.509 file.

Specify '$external'.

Specify MONGODB-X509.

认证x.509证书 (用ssl选项)

注意

  • 使用授权信息进行连接

  • 连接后进行认证

在连接时进行身份验证:

mongo --ssl --sslPEMKeyFile <path to CA signed client PEM file> --sslCAFile <path to root CA PEM file>  --authenticationDatabase '$external' --authenticationMechanism MONGODB-X509
选项
说明

客户端的x.509文件

Specify '$external'.

Specify MONGODB-X509.

译者:管祥青

A client x.509 certificate’s subject, which contains the Distinguished Name (DN), must differ from that of a .

At least one of the Organization (O), Organizational Unit (OU), or Domain Component (DC) attributes in the client certificate must differ from those in the and server certificates.

If the MongoDB deployment has set (available starting in MongoDB 4.2), the client x.509 certificate’s subject must also differ from that value.

If a client x.509 certificate’s subject has the same O, OU, and DC combination as the (or if set), the client connection is rejected. Only should use the same O, OU, and DC combinations as this grants full permissions.

客户端x.509证书的主题(subject),包含专有名称(DN)。必须不同与 的主题(subject)。

至少有一个组织(O),组织单元(OU),或域组件 (DC) 属性,在客户端证书必须与那些 和 服务器证书不同。

如果部署的MongoDB有 设置(在MongoDB 4.2版本中可用),那么客户端x.509证书的主题也必须与该值不同。

警告 如果客户端证书的主题有相同的O, OU, 和DC 组合为 (或 如果设置),客户端连接将被拒绝。只有 应该使用相同的O, OU, 和DC组合作为授予完全权限。

The procedures in this section use the tls settings/option (Available in MongoDB 4.2). For procedures using their ssl aliases, see .

You can configure a instance for x.509 authentication from the command-line. For example, to configure a standalone instance:

Include additional options as required for your configuration. For instance, if you wish remote clients to connect to your deployment or your deployment members are run on different hosts, specify the --bind_ip. For more information, see .

To set up x.509 authentication for replica sets or sharded clusters, see .

请注意 本节中使用tls设置/选项(在MongoDB 4.2中可用)。对于使用 ssl 别名,请参见 。

您可以通过命令行配置一个 实例用于x.509身份验证。例如,配置一个 实例:

根据需要配置可用其他选项。例如,如果您希望远程客户端连接到您部署的MongoDB数据库,或者您的部署MongoDB运行在不同的主机上,请指定--bind_ip。有关更多信息,请参见 。

要为复制集或分片集群设置x.509身份验证,请参见 。

The procedures in this section use the ssl settings/option. For procedures using their tls aliases (Available in MongoDB 4.2), see .

You can configure a instance for x.509 authentication from the command-line. For example, to configure a standalone instance:

Include additional options as required for your configuration. For instance, if you wish remote clients to connect to your deployment or your deployment members are run on different hosts, specify the --bind_ip. For more information, see .

To set up x.509 authentication for replica sets or sharded clusters, see .

注意 本节中使用 ssl 设置/选项。有关使用tls别名(在MongoDB 4.2版本中可用),请参见 。 tls 设置/选项提供了与ssl 选项相同的功能,因为MongoDB一直支持tls 1.0和以后的版本。

您可以通过命令行配置一个 实例用于x.509身份验证。例如,配置一个独立的 实例:

根据需要配置可用其他选项。例如,如果您希望远程客户端连接到部署的MongoDB数据库,或者您的部署MongoDB运行在不同的主机上,请指定--bind_ip。有关更多信息,请参见 。 x.509配置包括:

The RDNs in the subject string must be compatible with the standard.

For example, the following adds a user and grants the user role in the test database and the role:

See for details on adding a user with roles.

注意 subject 字符串中的RDNs必须兼容 标准。

The procedures in this section use the tls settings/option (Available in MongoDB 4.2). For procedures using their ssl aliases, see .

After you have , you can authenticate with the client certificate.

Certificate Authority file to verify the certificate presented by the instance.

注意 本节中使用 tls 设置/选项(在MongoDB 4.2版本中可用)。有关使用ssl别名,请参见 。

在您 之后,您可以使用客户端证书进行身份验证。

证书颁发机构文件来验证提供的实例,通过

The procedures in this section use the ssl settings/options. For procedures using their tls (Available in MongoDB 4.2) aliases, see .

After you have , you can authenticate with the client certificate.

Certificate Authority file to verify the certificate presented by / instance.

本节中使用ssl设置/选项。有关使用tls (在MongoDB 4.2版本中可用)别名,请参见 。 tls设置/选项提供了与 ssl 选项相同的功能,因为MongoDB一直支持tls 1.0和以后的版本。

在您 之后,您可以使用客户端证书进行身份验证。

证书颁发机构文件来验证提供的实例,通过 /

英文原文地址:

Prerequisites
Procedures
预备知识
流程
Disable TLS 1.0
TLS/SSL connection
clients to authenticate to servers with certificates
mongod
Use x.509 Certificate for Membership Authentication
禁用TLS 1.0
TLS/SSL连接
客户端使用证书认证服务
mongod
使用x.509证书对成员身份验证
Member x.509 Certificate
net.tls.clusterFile
net.tls.certificateKeyFile
tlsX509ClusterAuthDNOverride
Member x.509 Certificate
tlsX509ClusterAuthDNOverride
cluster member x509 certificates
成员x.509证书
net.tls.clusterFile
net.tls.certificateKeyFile
tlsX509ClusterAuthDNOverride
成员x.509证书
tlsX509ClusterAuthDNOverride
集群成员x509证书
MongoDB Deployment Configured for x.509 (Using SSL Options)
mongod
mongod
Localhost Binding Compatibility Changes
Use x.509 Certificate for Membership Authentication
使用x.509配置部署的MongoDB(使用TLS选项)
mongod
mongod
本地主机绑定兼容性更改
为成员身份验证使用x.509证书
MongoDB Deployment Configured for x.509 (Using TLS Options)
mongod
mongod
Localhost Binding Compatibility Changes
Use x.509 Certificate for Membership Authentication
使用x.509配置部署的MongoDB(使用TLS选项)
mongod
mongod
本地主机绑定兼容性更改
RFC2253
readWrite
userAdminAnyDatabase
Manage Users and Roles
RFC2253
Authenticate with a x.509 Certificate (Using ssl Options)
added the x.509 client certificate subject as a corresponding MongoDB user
使用x.509证书权限认证(用ssl选项)
添加x.509客户端证书的subject相当于创建一个MongoDB用户
Authenticate with a x.509 Certificate (Using tls Options)
added the x.509 client certificate subject as a corresponding MongoDB user
使用x.509证书进行验证(用tls选项)
添加x.509客户端证书的subject相当于创建一个MongoDB用户
https://docs.mongodb.com/v4.2/tutorial/configure-x509-client-authentication/
--tlsMode
--tlsCertificateKeyFile
--tlsCAFile
--tlsMode
--tlsCertificateKeyFile
--tlsCAFile
--sslMode
--sslPEMKeyFile
--sslCAFile
--sslMode
--sslPEMKeyFile
--sslCAFile
--tls
--tlsCertificateKeyFile
--tlsCAFile
mongod
--authenticationDatabase
--authenticationMechanism
--tls
--tlsCertificateKeyFile
--tlsCAFile
mongod
--authenticationDatabase
--authenticationMechanism
--ssl
--sslPEMKeyFile
--sslCAFile
mongod
mongos
--authenticationDatabase
--authenticationMechanism
--ssl
--sslPEMKeyFile
--sslCAFile
mongod
mongos
--authenticationDatabase
--authenticationMechanism