You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Joe Orton <jo...@redhat.com> on 2017/02/02 12:53:19 UTC
Underscores in hostnames
Another 2.4.25 regression reported from a Fedora user is that
underscores in hostnames are rejected by default now. I couldn't see a
specific discussion of this, was it deliberate?
Following breadcrumbs...
https://tools.ietf.org/html/rfc7230#section-5.4
Host = uri-host [ ":" port ] ; Section 2.7.1
https://tools.ietf.org/html/rfc7230#section-2.7
uri-host = <host, see [RFC3986], Section 3.2.2>
https://tools.ietf.org/html/rfc3986#section-3.2.2
host = IP-literal / IPv4address / reg-name
...
reg-name = *( unreserved / pct-encoded / sub-delims )
https://tools.ietf.org/html/rfc3986#section-2.3
unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
From google I can see that _ in hostnames has various issues, so I'm not
sure what is right here. It's simple enough to relax the check, seems
unlikely allowing ~ is a good idea.
Index: server/vhost.c
===================================================================
--- server/vhost.c (revision 1781359)
+++ server/vhost.c (working copy)
@@ -757,7 +757,10 @@
int is_dotted_decimal = 1, leading_zeroes = 0, dots = 0;
for (ch = host; *ch; ch++) {
- if (apr_isalpha(*ch) || *ch == '-') {
+ /* This should allow any character in 'uri-host' per RFC
+ * 7320s5.4, which is 'host' by RFC 3986, which matches any
+ * 'unreserved' character. */
+ if (apr_isalpha(*ch) || *ch == '-' || *ch == '_') {
is_dotted_decimal = 0;
}
else if (ch[0] == '.') {
Re: Underscores in hostnames
Posted by Joe Orton <jo...@redhat.com>.
On Thu, Feb 02, 2017 at 03:09:35PM +0200, Issac Goldstand wrote:
> AFAIK, underscores are forbidden from being part of a host name as per RFC
> 1123 Sec 2.1/RFC 952 (Assummptions Sec 1)
>
> It's also spelled out in RFC 3986:
> "
> A registered name intended for lookup in the DNS (...)
> consists of a sequence of domain labels separated by ".",
> each domain label starting and ending with an alphanumeric character
> and possibly also containing "-" characters.
Hah, right above where I quoted ;) Thanks Issac!
Regards, Joe
Re: Underscores in hostnames
Posted by Issac Goldstand <ma...@beamartyr.net>.
AFAIK, underscores are forbidden from being part of a host name as per
RFC 1123 Sec 2.1/RFC 952 (Assummptions Sec 1)
It's also spelled out in RFC 3986:
"
A registered name intended for lookup in the DNS (...)
consists of a sequence of domain labels separated by ".",
each domain label starting and ending with an alphanumeric character
and possibly also containing "-" characters.
"
Issac
On 2/2/2017 2:53 PM, Joe Orton wrote:
> Another 2.4.25 regression reported from a Fedora user is that
> underscores in hostnames are rejected by default now. I couldn't see a
> specific discussion of this, was it deliberate?
>
> Following breadcrumbs...
>
> https://tools.ietf.org/html/rfc7230#section-5.4
> Host = uri-host [ ":" port ] ; Section 2.7.1
>
> https://tools.ietf.org/html/rfc7230#section-2.7
> uri-host = <host, see [RFC3986], Section 3.2.2>
>
> https://tools.ietf.org/html/rfc3986#section-3.2.2
> host = IP-literal / IPv4address / reg-name
> ...
> reg-name = *( unreserved / pct-encoded / sub-delims )
>
> https://tools.ietf.org/html/rfc3986#section-2.3
> unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
>
>>From google I can see that _ in hostnames has various issues, so I'm not
> sure what is right here. It's simple enough to relax the check, seems
> unlikely allowing ~ is a good idea.
>
> Index: server/vhost.c
> ===================================================================
> --- server/vhost.c (revision 1781359)
> +++ server/vhost.c (working copy)
> @@ -757,7 +757,10 @@
> int is_dotted_decimal = 1, leading_zeroes = 0, dots = 0;
>
> for (ch = host; *ch; ch++) {
> - if (apr_isalpha(*ch) || *ch == '-') {
> + /* This should allow any character in 'uri-host' per RFC
> + * 7320s5.4, which is 'host' by RFC 3986, which matches any
> + * 'unreserved' character. */
> + if (apr_isalpha(*ch) || *ch == '-' || *ch == '_') {
> is_dotted_decimal = 0;
> }
> else if (ch[0] == '.') {
>
Re: Underscores in hostnames
Posted by Reindl Harald <h....@thelounge.net>.
Am 02.02.2017 um 14:22 schrieb Reindl Harald:
>
>
> Am 02.02.2017 um 13:53 schrieb Joe Orton:
>> Another 2.4.25 regression reported from a Fedora user is that
>> underscores in hostnames are rejected by default now. I couldn't see a
>> specific discussion of this, was it deliberate?
>
> underscores are not allowed in host names by RFC and many things will
> break at all with them because in different layers of client software
> things just break by using them
>
> we had that more than once in devel environments where strange bugs
> turend out to be another case where sombody used a underline in
> /etc/hosts and his local webserver
here you go:
https://en.wikipedia.org/wiki/Hostname#Restrictions_on_valid_hostnames
The Internet standards (Requests for Comments) for protocols mandate
that component hostname labels may contain only the ASCII letters 'a'
through 'z' (in a case-insensitive manner), the digits '0' through '9',
and the hyphen ('-'). The original specification of hostnames in RFC
952, mandated that labels could not start with a digit or with a hyphen,
and must not end with a hyphen. However, a subsequent specification (RFC
1123) permitted hostname labels to start with digits. No other symbols,
punctuation characters, or white space are permitted.
While a hostname may not contain other characters, such as the
underscore character (_), other DNS names may contain the underscore.[4]
Systems such as DomainKeys and service records use the underscore as a
means to assure that their special character is not confused with
hostnames. For example, _http._sctp.www.example.com specifies a service
pointer for an SCTP capable webserver host (www) in the domain
example.com. Note that some applications (e.g. Microsoft Internet
Explorer) won't work correctly if any part of the hostname contains an
underscore character.[5]
Re: Underscores in hostnames
Posted by Reindl Harald <h....@thelounge.net>.
Am 02.02.2017 um 13:53 schrieb Joe Orton:
> Another 2.4.25 regression reported from a Fedora user is that
> underscores in hostnames are rejected by default now. I couldn't see a
> specific discussion of this, was it deliberate?
underscores are not allowed in host names by RFC and many things will
break at all with them because in different layers of client software
things just break by using them
we had that more than once in devel environments where strange bugs
turend out to be another case where sombody used a underline in
/etc/hosts and his local webserver