Uploaded image for project: 'C Driver'
  1. C Driver
  2. CDRIVER-5712

Driver uses wrong authentication database for Atlas

    • Type: Icon: Bug Bug
    • Resolution: Works as Designed
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 1.27.5
    • Component/s: libmongoc
    • None
    • C Drivers
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?

      I am using the Mongo-C Driver in syslog-ng and have a connection string as this:

      mongodb+srv://dev.******.mongodb.net/raw-1?readPreference=primaryPreferred&tls=true&authSource=$external&authMechanism=MONGODB-X509&tlsCertificateKeyFile=/opt/mediation/certs/client.syslog-ng.pem&tlsCAFile=/etc/ssl/certs/ca-bundle.crt
      

      As you see, connection is authenticated with x.509 certificate rather than username+password.

      It throws an error at start:

      mongoc: Cannot override URI option "authSource" from TXT record "authSource=admin"
      

      According documentation, setting authSource=$external is needed when authentication is done by x.509 certificate, thus I cannot skip it.

       

      When I connect to an on-premise MongoDB, i.e.

      mongodb://tdube04mipmed1:27017,tdube04mipmed0:27017/raw-01?readPreference=primaryPreferred&tls=true&authSource=$external&authMechanism=MONGODB-X509&tlsCertificateKeyFile=/opt/mediation/certs/client.syslog-ng.pem&tlsCAFile=/etc/ssl/certs/ca-bundle.crt
      

      then it is working fine.

       

      I am using version mongo-c-driver.x86_64 1.27.5-1.el8 on Linux RHEL 8.1

      See few more details at mongodb driver uses wrong authentication database at MongoDB Atlas

            Assignee:
            kevin.albertson@mongodb.com Kevin Albertson
            Reporter:
            wernfried.domscheit@sunrise.net Wernfried Domscheit
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: