-
Notifications
You must be signed in to change notification settings - Fork 4.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consul's DNS parser allows junk between the DC and the consul subdomain #3200
Comments
Hi James For the fix, it's important that it still allows subdomains if they're set intentionally via the -domain cli flag. E.g. in our case, we use <nodename>.node[.dc].prod.consul for our production cluster and <nodename>.node[.dc].test.consul for our test cluster. |
Just circling back to see if there has been any progress on this? Worried that the longer it's left, the more pain it risks causing people when the bug's squashed (e.g. misconfigured service discovery that currently works thanks to the bug). |
I can have a look at this. |
Queries to the DNS server can contain an optional datacenter name in the query name. You can query for 'foo.service.consul' or 'foo.service.dc.consul' to get a response for either the default or a specific datacenter. Datacenter names cannot have dots, therefore the datacenter name can refer to only one element in the DNS query name. The DNS server allowed extra labels between the optional datacenter name and the domain and returned a valid response instead of returning NXDOMAIN. For example, if the domain is set to '.consul' then 'foo.service.dc1.extra.consul' should return NXDOMAIN because of 'extra' being between the datacenter name 'dc1' and the domain '.consul'. Fixes #3200
The https://github.com/hashicorp/consul/blob/v1.0.0/agent/dns.go#L360-L488 However, it seems the implementation is a bit too flexible and considers the last element before the |
Thanks very much @magiconair Fix seems good and looking forward to this landing in 1.0.1 |
Queries to the DNS server can contain an optional datacenter name in the query name. You can query for 'foo.service.consul' or 'foo.service.dc.consul' to get a response for either the default or a specific datacenter. Datacenter names cannot have dots, therefore the datacenter name can refer to only one element in the DNS query name. The DNS server allowed extra labels between the optional datacenter name and the domain and returned a valid response instead of returning NXDOMAIN. For example, if the domain is set to '.consul' then 'foo.service.dc1.extra.consul' should return NXDOMAIN because of 'extra' being between the datacenter name 'dc1' and the domain '.consul'. Fixes #3200
This captures an issue that came in from Google groups. It looks like Consul quietly drops anything after the DC and before the Consul subdomain:
Consul should parse this strictly and return an NXDOMAIN error for the cases with junk. I couldn't reproduce this anywhere other than between the DC and the Consul subdomain.
The text was updated successfully, but these errors were encountered: