Bug 54663 - Incorrect error message about FQDN format
Incorrect error message about FQDN format
Status: CLOSED FIXED
Product: UCS
Classification: Unclassified
Component: UDM (Generic)
UCS 5.0
Other Linux
: P5 normal (vote)
: UCS 5.0-1-errata
Assigned To: Carlos García-Mauriño
Peter Stoll
https://git.knut.univention.de/univen...
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2022-04-11 12:26 CEST by Carlos García-Mauriño
Modified: 2022-06-08 16:50 CEST (History)
3 users (show)

See Also:
What kind of report is it?: Bug Report
What type of bug is this?: 2: Improvement: Would be a product improvement
Who will be affected by this bug?: ---
How will those affected feel about the bug?: ---
User Pain:
Enterprise Customer affected?:
School Customer affected?:
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number:
Bug group (optional):
Max CVSS v3 score:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Carlos García-Mauriño univentionstaff 2022-04-11 12:26:32 CEST

    
Comment 1 Carlos García-Mauriño univentionstaff 2022-04-11 12:31:01 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.
Comment 2 Carlos García-Mauriño univentionstaff 2022-04-25 06:04:12 CEST
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).
Comment 3 Peter Stoll univentionstaff 2022-05-25 11:04:23 CEST
Reopened, as message does still not fit to validation.
Comment 4 Peter Stoll univentionstaff 2022-05-25 11:17:32 CEST
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.
Comment 5 Carlos García-Mauriño univentionstaff 2022-05-25 15:39:53 CEST
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.
Comment 6 Peter Stoll univentionstaff 2022-05-31 19:18:40 CEST
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."
Comment 7 Peter Stoll univentionstaff 2022-06-01 09:09:54 CEST
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."
Comment 8 Carlos García-Mauriño univentionstaff 2022-06-02 07:32:45 CEST
MR for the error message improvements: https://git.knut.univention.de/univention/ucs/-/merge_requests/410
Comment 9 Carlos García-Mauriño univentionstaff 2022-06-02 10:29:45 CEST
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).
Comment 10 Peter Stoll univentionstaff 2022-06-02 16:05:25 CEST
Verified code changes
YAML OK
Packet OK
Tested English and German error messages