Uploaded image for project: 'MongoDB Shell'
  1. MongoDB Shell
  2. MONGOSH-733

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

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 0.14.0
    • Affects Version/s: 0.12.0
    • Component/s: Connectivity
    • Labels:
    • 5
    • Not Needed
    • Iteration Barcelona, Iteration Chicago, Iteration Düsseldorf

      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:
            maurizio.casimirri@mongodb.com Maurizio Casimirri
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: