MongoDB 5.0.3 SSL Connection issues

My MongoDB 4.4.12 cluster/replica set 3nodes(1 primary, 2 secondary) (CentOS 7.0) operates perfectly.
The config file used mirrors the product documentation.
Startup command - > mongod --dbpath /data --config /data/mongodb.conf --bind_ip localhost,x.x.x.x
Connect string → mongo -u mstr -p --authenticationDatabase admin --tls --tlsAllowInvalidHostnames

When I build the cluster using Mongodb 5.0.3 with the same certs, paths, permissions …
I have to use the Connect string → mongo -u -p --authenticationDatabase admin --tls --tlsAllowInvalidHostnames --tlsAllowInvalidCertificates to connect successfully.
If I leave out the --tlsAllowInvalidCertificates option, I get "Error: couldn’t connect to server 127.0.0.1:27017, connection attempt failed: SocketException: invalid status response: connect@src/mongo/shell/mongo.js:372:17 @(connect):2:6
What did I not do correctly? Do I need to define the CAfile in the .conf file for 5.0.3? I recognize that there is an SSL handshake error. How do I fix? Please help? Thanks.

Check if your mongod is up with TLS.Yes you have to add TLS params
What does mongod.log show
Contents of your mongod.conf
You can add all params into your config file but here you are passing some params by command line in addition to config file
When you use tlsAllowInvalidCertificates you are bypassing the certificates(not presenting certificates).Thats why you are able to connect

1 Like