Univention Bugzilla – Bug 54663
Incorrect error message about FQDN format
Last modified: 2022-06-08 16:50:31 CEST
During the installation wizard of UCS, if the FQDN contains only numbers an exception is raised: `valueError: A host name or FQDN must start and end with a letter or number. In between additionally dashes, dots and underscores are allowed.` which is incorrect since the FQDN or host name cannot start with a number. The message should be modified to specify that it must begin with a letter.
MR merged (https://git.knut.univention.de/univention/ucs/-/merge_requests/328), package built (`15.0.11-47A~5.0.0.202204250550`) and advisory updated (https://git.knut.univention.de/univention/ucs/-/commit/bc342a33988c47116fbda925fb2555725f41f354).
Reopened, as message does still not fit to validation.
RFC-952 defines the following syntax for FQDN: <hname> ::= <name>*["."<name>] <name> ::= <let>[*[<let-or-digit-or-hyphen>]<let-or-digit>] According to that, each part of the FQDN has to start with a letter and not a digit. Further on, RFC-1123 updated that to allow also digits as a first character: 2.1 Host Names and Numbers The syntax of a legal Internet host name was specified in RFC-952 [DNS:4]. One aspect of host name syntax is hereby changed: the restriction on the first character is relaxed to allow either a letter or a digit. Host software MUST support this more liberal syntax. The validation in syntax.py does in general validate according to RFC-1123, but unfortunately, does also allow underscrores, which is not allowed.
Thanks for the information Peter. How should we proceed then? I see two options: a) adjust the error message to the existing validation in syntax.py. b) change the validation in syntax.py to match both RFC-952 and RFC-1123 and then adjust the errors accordingly. If we go with b) I think we should open a new issue.
In order to go with option b) we have to be sure, that there is really no working and required use case for using the underscore. So, this has to be handled with a separate bug. Therefore, I propose to adjust the error message to the currently existing validation. The message could be like that: "A hostname or any part of a FQDN, separated by dots, starts and ends with a letter or a digit. In between letters, digits, dashes and underscores are allowed." In german: "Ein Hostname und jeder Teil eines FQDN, getrennt durch Punkte, beginnt und endet mit einem Buchstaben oder einer Zahl. Dazwischen sind Buchstaben, Zahlen, Bindestriche und Unterstriche erlaubt."
As there is an additional validation which does not allow numbers only, which is not complaint to the RFC, The warning message should be updated accordingly: "A hostname or any part of a FQDN, separated by dots, starts and ends with a letter or a digit. In between letters, digits, dashes and underscores are allowed. Only numbers are not allowed." In german: "Ein Hostname und jeder Teil eines FQDN, getrennt durch Punkte, beginnt und endet mit einem Buchstaben oder einer Ziffer. Dazwischen sind Buchstaben, Ziffern, Bindestriche und Unterstriche erlaubt. Ausschließlich Ziffern sind nicht erlaubt."
MR for the error message improvements: https://git.knut.univention.de/univention/ucs/-/merge_requests/410
MR merged (https://git.knut.univention.de/univention/ucs/-/merge_requests/410), package built (`univention-directory-manager-modules`: `15.0.11-50A~5.0.0.202206021026`) and advisory updated (https://git.knut.univention.de/univention/ucs/-/commit/b34a0d4f70a5a6df9dbca172c8c428504c311b26).
Verified code changes YAML OK Packet OK Tested English and German error messages
<https://errata.software-univention.de/#/?erratum=5.0x335>