mail-in-a-box / mailinabox

Mail-in-a-Box helps individuals take back control of their email by defining a one-click, easy-to-deploy SMTP+everything else server: a mail server in a box.
https://mailinabox.email/
Creative Commons Zero v1.0 Universal
13.88k stars 1.43k forks source link

DNS updates should convert subdomains to lowercase #2005

Open zoof opened 3 years ago

zoof commented 3 years ago

I recently tried to set the www subdomain for one of the domain names managed by MIAB and because I did it using an iPhone, it typed as Www. This resulted in both www and Www recorded in the domain records.

Since domains are case independent, it should be automatically converted to lowercase before being set.

nomandera commented 3 years ago

It is my understanding that technically A/MX records are case sensitive whereas the domain name itself is not.

myfirstnameispaul commented 3 years ago

Per RFC, I'm pretty sure all DNS resolution is case-insensitive, so the only stuffs case-sensitive would be anything before the @ in an email address and anything after the TLD (e.g., /). A case-sensitive request is supposed to be processed as case-insensitive.

As with most things, software can be configured to do something other than an RFC compliant output.

nomandera commented 3 years ago

How deep this rabbit holes goes.

https://www.dnscheck.co/faq#are-dns-records-case-sensitive

DNS Check has the following case-sensitivity behavior:

Host names (or 'labels'), such as example.com are case-insensitive.
DNS record types, such as 'A', and 'MX' are case sensitive.
Values in TXT and SPF records are case sensitive. All other DNS record types have case-insensitive values. 

https://serverfault.com/questions/261341/is-the-hostname-case-sensitive/261344

Short answer: DNS should not be case sensitive, but the question and answer will need to be identical case, in the future.

There is also https://developers.google.com/speed/public-dns/docs/security#randomize_case

and countless citations to people saying "DNS is always case insensitive" and others that RFC say "should" be but not "must" be which is more than a semantic difference.

tl;dr its likely that it should be case insensitive but there is enough latitude in the generations of spec word and interpretation that it may not actually have to be. Fascinating topic.

tl;dr2 i now know enough to know i dont know enough. curious if anyone has something set in stone that summarises the situation in 2021

myfirstnameispaul commented 3 years ago

The DNS Check one is interesting:

Host names (or 'labels'), such as example.com are case-insensitive.

I interpret this to include the subdomains, as that can be part of a host name or label.

DNS record types, such as 'A', and 'MX' are case sensitive.

This is just the type, so A, AAAA, MX, TXT, TLSA, NS, DNSKEY, etc., are case sensitive, but this is not a host name. I do notice when I run dig it converts the command line txt to TXT in the question section:

$ dig txt example.com

; <<>> DiG 9.16.1-Ubuntu <<>> txt example.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 1948
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
;; QUESTION SECTION:
;example.com.           IN  TXT

Values in TXT and SPF records are case sensitive. All other DNS record types have case-insensitive values.

So this is just the contents of the record, which is also not a host name.

To summarize, the author or authors of that page have concluded that DNS host names are case-insensitive.

I have difficult fully groking rfc4343, but in regards to DNS resolution, I conclude it is stating that it is case-insensitive, if only from the Abstract:

Domain Name System (DNS) names are "case insensitive". This document explains exactly what that means and provides a clear specification of the rules. This clarification updates RFCs 1034, 1035, and 2181.

And were I ever to find myself involved in authoring a standards document, this is the sort of historical minutia I should like to include:

(Historical note: The terms "uppercase" and "lowercase" were invented after movable type. The terms originally referred to the two font trays for storing, in partitioned areas, the different physical type elements. Before movable type, the nearest equivalent terms were "majuscule" and "minuscule".)

zoof commented 3 years ago

This is all very interesting but from a practical standpoint, I think the relevant question is whether it is desirable for MIAB to set separate records for domains with different upper/lower case spellings. E.g., Www.example.com and www.example.com. Gandi.net for instance does not allow Www.example.com and www.example.com.

JoshData commented 3 years ago

It should be forced to lowercase, yes. This isn't the only way this can happen though: IDNA "punycode" encoding of internationalized domains can have a similar problem.