Merge pull request #99329 from 0x4A6F/master-networking-hostname

nixos: Conform with RFC 1123 in networking.hostName
This commit is contained in:
Florian Klink 2020-10-02 22:01:51 +02:00 committed by GitHub
commit 93178d471e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 6 deletions

View file

@ -594,8 +594,8 @@ systemd.services.nginx.serviceConfig.ReadWritePaths = [ "/var/www" ];
<listitem>
<para>
The hostname (<literal>networking.hostName</literal>) must now be a valid
DNS label (see RFC 1035) and as such must not contain the domain part.
This means that the hostname must start with a letter, end with a letter
DNS label (see RFC 1035, RFC 1123) and as such must not contain the domain part.
This means that the hostname must start with a letter or digit, end with a letter
or digit, and have as interior characters only letters, digits, and
hyphen. The maximum length is 63 characters. Additionally it is
recommended to only use lower-case characters.

View file

@ -381,13 +381,14 @@ in
# syntax). Note: We also allow underscores for compatibility/legacy
# reasons (as undocumented feature):
type = types.strMatching
"^$|^[[:alpha:]]([[:alnum:]_-]{0,61}[[:alnum:]])?$";
"^$|^[[:alnum:]]([[:alnum:]_-]{0,61}[[:alnum:]])?$";
description = ''
The name of the machine. Leave it empty if you want to obtain it from a
DHCP server (if using DHCP). The hostname must be a valid DNS label (see
RFC 1035 section 2.3.1: "Preferred name syntax") and as such must not
contain the domain part. This means that the hostname must start with a
letter, end with a letter or digit, and have as interior characters only
RFC 1035 section 2.3.1: "Preferred name syntax", RFC 1123 section 2.1:
"Host Names and Numbers") and as such must not contain the domain part.
This means that the hostname must start with a letter or digit,
end with a letter or digit, and have as interior characters only
letters, digits, and hyphen. The maximum length is 63 characters.
Additionally it is recommended to only use lower-case characters.
'';