I have a free, shared tier of a MongoDB Atlas version 6.0.11 cluster an SSL is enabled, so how do I get the SSL cert required to connect to it? the simple connection string is not enough
Hi @Brennan_Ow,
What is the context regarding this question? Iâd recommend going over the FAQ: Security documentation for Atlas.
Can you also verify what you mean by âthe simple connection string is not enoughâ?
Regards,
Jason
Context: To connect to my free and shared tier cluster, Iâm using the python code
uri = "mongodb+srv://<username>:<password>@cluster0.w029iod.mongodb.net/?retryWrites=true&w=majority"
client = MongoClient(uri, server_api=ServerApi('1'))
and sometimes it works, but sometimes I get the error stating that the SSL handshake failed.
I even tried using the X.509 method with and the SSL handshake failure error message still happens 50% of the time
client = MongoClient(uri,
tls=True,
tlsCertificateKeyFile=âpath/to/file.pemâ,
server_api=ServerApi(â1â))
Whatâs the pymongo driver version youâre using and whatâs the full error message being generated?
Regards,
Jason
Thank you for continuing to follow up with me, but I have found a fix for it already. It turns out the ISP that I was using had some firewall configuration that did not allow me to connect to the cluster. So I outsourced the job of connecting to the cluster to a GitHub action where itâs ISP had no such issues.
I came to the conclusion after reading this â Error: couldn't connect to server 127.0.0.1:27017 - #16 by Stennie_X
specifically, this part
- Your connection from client to server is blocked by firewall or network configuration
As for my pymongo version, it is 4.6.0
The error message was as follows
SSL handshake failed: <shard_id>.mongodb.net:27017: [WinError 10054] An existing connection was forcibly closed by the remote host (configured timeouts: socketTimeoutMS: 20000.0ms, connectTimeoutMS: 20000.0ms)
Thank you for your time
This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.