dns-proxy-server icon indicating copy to clipboard operation
dns-proxy-server copied to clipboard

Container-name lookup results are case-sensitive.

Open ulidtko opened this issue 4 years ago • 0 comments

Hi!

It turns out, some programs (including Postman) will garble hostnames by force-lowercasing them before querying. I'm not ready to start judging if they're right or wrong in doing that; just RFC 4343 alone tryies to clarify the whole "case-insensitivity in DNS" topic.

The fact is, DPS chokes on that. For repro, run with MG_REGISTER_CONTAINER_NAMES=1 and:

$ docker run -d --name fooBar alpine sleep infinity
6799e0325f4146dd79f8c977a2c6f7fd0170439b1412627d765605d9d00aa8b8

$ ping fooBar.docker
PING fooBar.docker (172.17.0.3) 56(84) bytes of data.
64 bytes from 172.17.0.3 (172.17.0.3): icmp_seq=1 ttl=64 time=0.077 ms
64 bytes from 172.17.0.3 (172.17.0.3): icmp_seq=2 ttl=64 time=0.136 ms
^C
--- fooBar.docker ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1001ms
rtt min/avg/max/mdev = 0.077/0.106/0.136/0.029 ms

$ ping foobar.docker
ping: foobar.docker: Name or service not known

To the poor Postman, this manifests as ENOTFOUND from getaddrinfo("foobar.docker") with no way to workaround:

image

Regardless of the perhaps-broken client (which simply exposes the issue) — I believe, the DNS server portion of DPS is expected to make comparisons case-insensitively against its internal name db. Quoting from the original 1987 DNS RFC:

By convention, domain names can be stored with arbitrary case, but domain name comparisons for all present domain functions are done in a case-insensitive manner, assuming an ASCII character set, and a high order zero bit.

DPS version: 2.19.0

ulidtko avatar Mar 31 '21 11:03 ulidtko