Uploaded image for project: 'Compass '
  1. Compass
  2. COMPASS-4768

Driver does not consult OS DNS APIs when resolving SRV/TXT/CNAME

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 1.31.0
    • Affects Version/s: 1.26.1
    • Component/s: Connectivity
    • None
    • Not Needed
    • Iteration Seoul

      The Node.js driver uses different DNS resolution mechanisms for different situations.

      For establishing connections to servers, it does not provide an explicit DNS lookup mechanism, so Node.js uses its default of dns.lookup(). dns.lookup() is an API that forwards requests to the OS DNS APIs.

      For resolving mongodb+srv:// URLs (and kerberos hostnames), the driver uses the dns.resolve* family of methods. These methods always send actual UDP packets to DNS servers, which are recorded through an OS API the first time the driver is loaded.

      This has some implications for devtools connectivity. In particular, when performing UDP-based communication with the DNS servers in question is not possible, which can happen In VPN environments, the driver is unable to resolve mongodb+srv:// URLs.

      Consequently, we probably need a way to customize the driver’s DNS resolution behavior. This could happen by replacing methods on the dns module, for example, or by adding driver options to override the DNS methods used by the driver, or by spinning up a temporary, in-process DNS server that we then tell Node.js to talk to by passing it to dns.setServers() (this last option is probably quite involved, but would not require changes on the driver side or monkey-patching Node.js APIs).

      Any approach that emulates what e.g. the `mongo` legacy shell, or other, non-Node.js-based tools do, will have to involve native code, whether as an addon, or as a separate executable.

            Assignee:
            anna.henningsen@mongodb.com Anna Henningsen
            Reporter:
            anna.henningsen@mongodb.com Anna Henningsen
            Votes:
            3 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: