mongodb - 带有自签名证书的 Mongo URI
问题描述
我试图让 Mongo URI 连接使用自签名证书。
命令行工作得很好,所以以下连接:
mongo mongodb://Qlik:Password1@mongobox.test:27017 --ssl --sslAllowInvalidCertificates
但是,根据文档,没有sslAllowInvalidCertificates=true
URI 连接选项,也没有任何方法可以提供证书(这在我的堆栈中无论如何都是一个问题)
URI 等价物:
mongo "mongodb://Qlik:Password1@mongobox.test:27017/?ssl=true&sslAllowInvalidCertificates=true"
结果是:
2019-10-17T07:19:00.490+0000 E QUERY [js] Error: couldn't connect to server mongobox.test:27017, connection attempt failed: SSLHandshakeFailed: SSL peer certificate validation failed: unable to get local issuer certificate :
connect@src/mongo/shell/mongo.js:344:17
@(connect):2:6
exception: connect failed
如何让 URI 连接与自签名证书一起使用?
解决方案
mongo --host example.test \
--ssl \
--tlsAllowInvalidCertificates \
--username myUsername
推荐阅读
- c - 套接字 C - 协议不支持的地址系列
- python - 无论物理设备的方向如何,Appium 屏幕截图有时会横向保存或倒置保存
- azure - 如何从部署在 Azure Kubernetes 服务 (AKS) 中作为 pod 的 Asp.net Core Docker 容器访问 Azure KeyVault?
- azure-data-explorer - 在 Kusto 中聚合列值
- python - 从python中的另一个函数中查找函数的出现次数
- sql - 当大多数查询将导致冲突时运行插入冲突
- nearprotocol - 处理 NEAR 区块链中的承诺链故障
- mongodb - Flask-paginate + MongoDB 全文搜索 Error $search has wrong type when hit page 2
- jenkins - Jenkins slave pod 离线
- bootstrap-4 - 当我点击切换器图标时,引导导航栏不显示