Driver uses wrong authentication database for Atlas

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Works as Designed
    • Priority: Major - P3
    • None
    • Affects Version/s: 1.27.5
    • Component/s: libmongoc
    • None
    • 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?
    • None
    • None
    • None
    • None
    • None
    • None

      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
              Reporter:
              Wernfried Domscheit
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: