Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-32164

Shell SRV implementation does not allow `authSource` from TXT records to be used

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Blocker - P1
    • Resolution: Fixed
    • Affects Version/s: 3.7 Required, 3.6.0
    • Fix Version/s: 3.6.1, 3.7.1
    • Component/s: None
    • Labels:
      None

      Description

      I would like to be able to connect to an authenticated replica set with the following command when the _mongodb._tcp.mycluster SRV record existed and a TXT record existed containing authSource=admin&replicaSet=mycluster.

      mongo "mongodb+srv://mycluster/test" --username cory --password
      

      Using this command against the 3.6.0 shell fails because the test database is used as the auth source. This occurs because the URI parsing ignores the authSource in the TXT record because username is not also specified in the URI.

      If I were to move the username to the URI, then the shell no longer prompts for a password and does not authenticate properly. i.e:

      mongo "mongodb+srv://mycluster/test?username=cory" --password
      

      The current workaround is to specify "--authenticationDatabase admin" on the command line instead of using the TXT record.

      Ideally the first example would work, and the shell would use the authSource from the URI (via the TXT record) even though the username is specified on the command line and not explicitly in the URI. The second example also seems acceptable but less consistent.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              adam.martin ADAM Martin (Inactive)
              Reporter:
              cory.mintz Cory Mintz
              Participants:
              Votes:
              0 Vote for this issue
              Watchers:
              9 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: