Uploaded image for project: 'Ruby Driver'
  1. Ruby Driver
  2. RUBY-2293

Document retrieving auth source from TXT records with SRV URIs

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 2.13.1
    • Affects Version/s: None
    • Component/s: Docs
    • Labels:
      None
    • Fully Compatible

      We have a tutorial section describing the process the driver follows to determine auth source (https://docs.mongodb.com/ruby-driver/master/tutorials/ruby-driver-authentication/#auth-source). This section is missing an important aspect of the process - if the client is instantiated with a SRV URI, the driver will query TXT records for this URI for URI options and would merge those with explicitly specified options. Atlas in particular gives authSource=admin in the relevant TXT records which affects the auth source used by the driver.

      Example from my test deployment:

      butler% dig -t TXT cluster0-tut4d.mongodb.net       
      
      ; <<>> DiG 9.11.5-P4-5.1-Debian <<>> -t TXT cluster0-tut4d.mongodb.net
      ;; global options: +cmd
      ;; Got answer:
      ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 63677
      ;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 4, ADDITIONAL: 8
      
      ;; OPT PSEUDOSECTION:
      ; EDNS: version: 0, flags:; udp: 4096
      ; COOKIE: 31d32c93b1d73a67115b65bb5ef61aed183a589080010dd7 (good)
      ;; QUESTION SECTION:
      ;cluster0-tut4d.mongodb.net.	IN	TXT
      
      ;; ANSWER SECTION:
      cluster0-tut4d.mongodb.net. 60	IN	TXT	"authSource=admin&replicaSet=Cluster0-shard-0"
      
      ;; AUTHORITY SECTION:
      mongodb.net.		82425	IN	NS	ns-1043.awsdns-02.org.
      mongodb.net.		82425	IN	NS	ns-1647.awsdns-13.co.uk.
      mongodb.net.		82425	IN	NS	ns-430.awsdns-53.com.
      mongodb.net.		82425	IN	NS	ns-761.awsdns-31.net.
      
      ;; ADDITIONAL SECTION:
      ns-430.awsdns-53.com.	82425	IN	A	205.251.193.174
      ns-761.awsdns-31.net.	82425	IN	A	205.251.194.249
      ns-1043.awsdns-02.org.	82425	IN	A	205.251.196.19
      ns-1647.awsdns-13.co.uk. 82425	IN	A	205.251.198.111
      ns-430.awsdns-53.com.	82425	IN	AAAA	2600:9000:5301:ae00::1
      ns-1043.awsdns-02.org.	82425	IN	AAAA	2600:9000:5304:1300::1
      ns-1647.awsdns-13.co.uk. 82425	IN	AAAA	2600:9000:5306:6f00::1
      
      ;; Query time: 12 msec
      ;; SERVER: 10.0.9.254#53(10.0.9.254)
      ;; WHEN: Fri Jun 26 11:59:08 EDT 2020
      ;; MSG SIZE  rcvd: 425
      

            Assignee:
            oleg.pudeyev@mongodb.com Oleg Pudeyev (Inactive)
            Reporter:
            oleg.pudeyev@mongodb.com Oleg Pudeyev (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: