-
Notifications
You must be signed in to change notification settings - Fork 263
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TLS connection with mongo cluster failed (while single host works) #947
Comments
Neither the PHP driver nor library take a For example:
So please prepare two scripts (each with the appropriate connection options) and share their output when executing them through a CLI environment. I expect we'll see no output if The PHP driver's TLS is handled by whatever library is linked by libmongoc (and detected during compilation). This will most likely be OpenSSL, but the particular version of OpenSSL used may still differ from other applications (e.g. Mongo Studio 3T) if you happen to have multiple versions on your system. We can confirm exactly what libmongoc uses by running
The "IP address mismatch" error suggests that the certificate is actually being properly checked by OpenSSL and the root issue is likely an incorrect certificate configuration. You should also be able to verify the certificate directly using the openssl verify command and the |
Note: I restored the original bug report contents since this may be relevant to other users that come across the same error message down the line. |
Bug Report
Hi, I need to connect to Mongo from PHP7.3. I used this library it works perfectly without TLS. When I use TLS, it works if I just specify the mongo host with single host name such as 'host' => 'dev2-ent-mongodb1' (with replicaSet and CAfile etc). But it throw this error when I specify the host as a cluster such as:
'host' => 'dev2-ent-mongodb1,dev2-ent-mongodb2,dev2-ent-mongodb3'
The error log:
No suitable servers found:
serverselectiontimeoutms
timed out: [TLS handshake failed: certificate verify failed (64): IP address mismatch calling hello on '10.107.1.202:27017'] [TLS handshake failed: certificate verify failed (64): IP address mismatch calling hello on '10.107.1.68:27017'] [TLS handshake failed: certificate verify failed (64): IP address mismatch calling hello on '10.107.1.135:27017']With the host set as a cluster and the flag "tlsAllowInvalidHostnames" => true, it works as well.
But with Mongo Studio 3T, it works perfectly without this flag set. So it looks like a problem in this library.
Environment
PHP7.3 (with Phalcon 3.4.5)/Ubuntu20
Test Script
Expected and Actual Behavior
working in Apache and Cron job.
Debug Log
No suitable servers found:
serverselectiontimeoutms
timed out: [TLS handshake failed: certificate verify failed (64): IP address mismatch calling hello on '10.107.1.202:27017'] [TLS handshake failed: certificate verify failed (64): IP address mismatch calling hello on '10.107.1.68:27017'] [TLS handshake failed: certificate verify failed (64): IP address mismatch calling hello on '10.107.1.135:27017']The text was updated successfully, but these errors were encountered: