Uploaded image for project: 'Node.js Driver'
  1. Node.js Driver
  2. NODE-508

SSL connections to Mongos will not complete

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 2.0.40
    • Affects Version/s: 2.0.37
    • Component/s: None
    • Environment:
      All

      When creating an SSL connection to a mongos the documentation would get you to create it with...

      MongoClient.connect("mongodb://dumper:dumper@example.1.dblayer.com:10900,example.0.dblayer.com:10901/dbname", {
      mongos:

      { ssl: true, sslValidate: true, sslCA: ca, poolSize: 1, reconnectTries: 1 }

      ,
      }, function(err, db) { ...

      Which for other connections works, but with Mongos it will sit in a spin never connecting.

      The reason to this is that mongodb-core uses `ca` for it's certificate array. Other connections when preparing options copy the value of sslCA to ca and continue down to making their mongodb-core connection. The MongoS code doesn't do that.

      There is a workaround for anyone affected, and thats to add ca: value to the options map too like so:

      MongoClient.connect("mongodb://dumper:dumper@example.1.dblayer.com:10900,example.0.dblayer.com:10901/dbname", {
      mongos:

      { ssl: true, sslValidate: true, sslCA: ca, ca: ca, poolSize: 1, reconnectTries: 1 }

      ,
      }, function(err, db) { ...

      And the connection will then work.

            Assignee:
            christkv Christian Amor Kvalheim
            Reporter:
            codepope Dj Walker-Morgan
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: