安装mongodb需要ssl吗
安装MongoDB是需要配置ssl的。关于MongoDB 的SSL 配置, 官方文档挺齐全的。
win10 64位 安装 OpenSSL-Win64 的安装版, 添加环境变量path
由于文档提供的基本是Linux 的, 网上搜索到的也是Linux 这样的, 自己改成了 windows 的
G: cdG:\ca opensslreq-newkeyrsa:2048-new-x509-days365-nodes-outmongodb-cert.crt-keyoutmongodb-cert.key copy/b/ymongodb-cert.key+mongodb-cert.crtmongodb.pem
这个是直接使用了CA根证书, 和由key+证书组成的CA服务器证书(mongodb 要求key+cert 合成的pem)。
推荐教程《python教程》
配置文件
net: port:27000 bindIp:127.0.0.1 ssl: mode:requireSSL PEMKeyFile:G:\ca\mongodb.pem CAFile:G:\ca\mongodb-cert.crt allowInvalidHostnames:true
如果有集群, 加上
security: authorization:enabled clusterAuthMode:x509
启动MongoDB 后, 用mongo 客户端连接, 因为是自己建的证书, 所以--sslAllowInvalidCertificates 是必要的。
本网站文章仅供交流学习 ,不作为商用, 版权归属原作者,部分文章推送时未能及时与原作者取得联系,若来源标注错误或侵犯到您的权益烦请告知,我们将立即删除.