Hi @Takis, @Prasad_Saya
I am trying to connect to MongoDB server through mongo client and facing following error:
SSL peer certificate validation failed: self signed certificate
Detailed error message is:
mongo --tls --tlsCertificateKeyFile /etc/ssl/test-client.pem --tlsCAFile /etc/ssl/test-ca.pem
2MongoDB shell version v4.4.6 3connecting to: mongodb://127.0.0.1:27017/?compressors=disabled&gssapiServiceName=mongodb 4{“t”:{"$date":“2021-07-30T09:29:50.080Z”},“s”:“E”, “c”:“NETWORK”, “id”:23256, “ctx”:“js”,“msg”:“SSL peer certificate validation failed”,“attr”:{“error”:“SSL peer certificate validation failed: self signed certificate”}} 5Error: couldn’t connect to server 127.0.0.1:27017, connection attempt failed: SSLHandshakeFailed: SSL peer certificate validation failed: self signed certificate : 6connect@src/mongo/shell/mongo.js:374:17 7@(connect):2:6 8exception: connect failed 9exiting with code 1
I have followed steps given on MongoDB site to generate the Server, client certificates and pem files:
Appendix A - OpenSSL CA Certificate for Testing
and followed steps given for client certificates for testing.
OS and Server details:
OS: CentOS 7 (CentOS Linux release 7.8.2003 (Core))
MongoDB Server: MongoDB server version: 4.4.6
MongoDB shell version: v4.4.6
Am I missing something?
Please let me know if you need more details on configuration.
# network interfaces
net:
port: 27017
bindIp: 127.0.0.1 # Enter 0.0.0.0,:: to bind to all IPv4 and IPv6 addresses or, alternatively, use the net.bindIpAll setting.
tls:
mode: requireTLS
certificateKeyFile: /etc/ssl/test-server1.pem
CAFile: /etc/ssl/test-ca.pem