Skip to content
This repository has been archived by the owner on Dec 7, 2018. It is now read-only.

DNS should use search domains by default #146

Open
aronchick opened this issue May 13, 2015 · 6 comments
Open

DNS should use search domains by default #146

aronchick opened this issue May 13, 2015 · 6 comments
Milestone

Comments

@aronchick
Copy link

Currently, Resolv::DNS does not use search domains by default. This is, IMHO, broken. Celluloid should use these domains. To repro, you need a domain that is only available via a search domain, not the standard DNS on the system (I'm using Kubernetes) - client is the name of a service in Kubernetes, which is resolvable via the search domains:

[1] pry(main)> require 'resolv'
=> true
[2] pry(main)> Resolv::DNS.new.getaddresses('client')
=> []
[3] pry(main)> nameservers = ["10.0.0.10", "169.254.169.254", "10.240.0.1"]
[4] pry(main)> search_domains = ["default.kubernetes.local", "kubernetes.local", "c.bar-foobar-91020.internal.", "55618245300.google.internal.", "google.internal."]
[5] pry(main)> a = Resolv::DNS.new(:nameserver => nameservers, :search => search_domains)
[...output...]
[6] pry(main)> a.getaddresses('client')
=> [#<Resolv::IPv4 10.0.118.178>]
@digitalextremist
Copy link
Member

@ioquatix is the Celluloid::DNS contributor, which I believe Celluloid::IO will be refactored to use. But calling something broken because the default behavior you expect is not how you expect it to be, then expecting a library which uses that dependency to change its behavior per your view? If Resolve::DNS is in fact staying, then I could perhaps see providing access to the configuration so you can set that yourself?

@aronchick
Copy link
Author

I believe a user's expected experience is that anything that uses DNS should use the search domains - as curl, wget, and countless other applications do, and is specified in resolv.conf man page:

man resolv.conf

domain Local domain name.
Most queries for names within this domain can use short names relative to the local domain. If no domain entry is present, the domain is determined from the local hostname returned by gethostname(2); the domain part is taken to be everything after the first '.'. Finally, if the hostname does not contain a domain part, the root domain is assumed.

search Search list for host-name lookup.
The search list is normally determined from the local domain name; by default, it contains only the local domain name. This may be changed by listing the desired domain search path following the search keyword with spaces or tabs separating the names. Resolver queries having fewer than ndots dots (default is 1) in them will be attempted using each component of the search path in turn until a match is found. For environments with multiple subdomains please read options ndots:n below to avoid man-in-the-middle attacks and unnecessary traffic for the root-dns-servers. Note that this process may be slow and will generate a lot of network traffic if the servers for the listed domains are not local, and that queries will time out if no server is available for one of the domains. The search list is currently limited to six domains with a total of 256 characters.

That Resolv::DNS does not do this by default feels like a bad user experience - and cascades down to anything that uses it (including Celluloid - today, anyway).

@jgrowl
Copy link

jgrowl commented May 23, 2015

+1
I think it makes a lot of sense to use the search domain.

@ioquatix
Copy link
Contributor

ioquatix commented Aug 4, 2015

You should discuss this on the Celluloid::DNS issue tracker and feel free to submit a PR.

@digitalextremist digitalextremist modified the milestone: 0.18.0 Aug 9, 2015
@clonezone
Copy link

I'm able to work around this because all of my current non-fully-qualified domains need the same suffix applied to them. I don't know how I would work around this otherwise.

@ioquatix
Copy link
Contributor

@aronchick @clonezone Let's discuss this on the Celluloid-DNS issue tracker.

@celluloid celluloid locked and limited conversation to collaborators Sep 21, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants