Skip to content

TLS connection with mongo cluster failed (while single host works) #947

Closed as not planned
@HalleyUK

Description

@HalleyUK

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']

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions