#851357 Regression: No longer supports ServerName containing underscore

Package:
apache2
Source:
apache2
Description:
Apache HTTP Server
Submitter:
Jonathan Vollebregt
Date:
2021-12-14 08:57:22 UTC
Severity:
important
Tags:
#851357#5
Date:
2017-01-14 10:39:39 UTC
From:
To:
Dear Maintainer,

somewhere between 2.4.23-8 and 2.4.25-1 there was a regression that causes
apache to ignore ServerName directives containing underscores.

I have since tested and confirmed that removing the underscore fixes the
problem as does installing version 2.4.10-10+deb8u7

There is nothing in the error log indicating a problem (Not
surprising since it's not recognising the virtualhost at all)

The site conf file:

	$ cat /etc/apache2/sites-available/kint_test.conf
	<VirtualHost *:80>
		ServerName kint_test.local
		ServerAdmin webmaster@localhost
		DocumentRoot /home/j/localhost/kint_test
		ErrorLog ${APACHE_LOG_DIR}/error.log
		CustomLog ${APACHE_LOG_DIR}/access.log combined
	</VirtualHost>

The folder in question: (chmod -R 777, and other sites under
/home/j/localhost work fine so it's not a file permission issue)

	$ ls -l /home/j/localhost/kint_test
	total 8
	-rwxrwxrwx 1 j j 0 Jan 14 11:18 index.html

Relevant part of apache2.conf:

	<Directory /home/j/localhost>
		Options Indexes FollowSymLinks
		AllowOverride All

		Require ip 192.168
		Require local
	</Directory>

Relevant part of hosts file:

	$ grep kint_test /etc/hosts
	127.0.0.1	kint_test.local

Server response:

	$ curl kint_test.local
	<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
	<html><head>
	<title>400 Bad Request</title>
	</head><body>
	<h1>Bad Request</h1>
	<p>Your browser sent a request that this server could not understand.<br />
	</p>
	<p>Additionally, a 400 Bad Request
	error was encountered while trying to use an ErrorDocument to handle the request.</p>
	<hr>
	<address>Apache/2.4.25 (Debian) Server at 127.0.1.1 Port 80</address>
	</body></html>

#851357#10
Date:
2017-01-14 10:53:53 UTC
From:
To:
Hi Jonathan,

while I agree that such changes should not happen within one Debian release
and the maintainer might want to relax the rules for the package, the
ServerName accepts a hostname as a parameter and a valid hostname cannot
contain underscore. So the Apache is behaving correctly here not accepting
invalid hostname.

Cheers, Ondřej

#851357#15
Date:
2017-01-14 11:19:17 UTC
From:
To:
It doesn't help that the apache docs on the ServerName directive seem to
use domainname and hostname interchangeably (While the restrictions you
mentioned only apply to hostnames)

 > Description:	Hostname and port that the server uses to identify itself
 > Syntax:	ServerName [scheme://]domain-name|ip-address[:port]

Does this mean it's now impossible to create virtual hosts in apache for
domain names with underscores?

Unless they've silently added a DomainName directive somewhere this
change breaks virtual hosts with internationalized domain names too
since as you mentioned hostnames have to be /[a-z0-9]([a-z0-9-]*[a-z0-9])?/i

Since ServerName has historically acted as it takes a domainname I
imagine it would be smarter for upstream to change the docs to use the
word Domainname rather than change the functionality to break a few
million domains.

#851357#20
Date:
2017-01-14 11:33:55 UTC
From:
To:
http://www.ietf.org/rfc/rfc952.txt

 >      <hname> ::= <name>*["."<name>]
 >      <name>  ::= <let>[*[<let-or-digit-or-hyphen>]<let-or-digit>]

Unless this was updated in another RFC that means apache shouldn't even
support subdomains in virtual hosts, and say goodbye to the .co.uk tld!

Furthermore the RFC2616 (HTTP/1.1) docs give an invalid hostname as
their example for the Host request header:

https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.23

 >       GET /pub/WWW/ HTTP/1.1
 >       Host: www.w3.org

I think we can write this off as confusion due to the apache
documentation and say this is an actual bug and ServerName is supposed
to take domainnames

#851357#25
Date:
2017-01-14 16:22:02 UTC
From:
To:
No, the *[ ... ] syntax means an arbitrary number of the thing in the
brackets.

I don't think underscores in domain names are allowed in general. But I know
that they are in are in wide use. So maybe there should be an exception or an
explicit knob to allow them.

A workaround is

HTTPProtocolOptions unsafe

#851357#30
Date:
2017-01-14 16:26:24 UTC
From:
To:
Is/was it really possible to use international non-ASCII domain names in the
apache config? Don't you have to use the puny-code escaped variants?

#851357#35
Date:
2017-01-14 17:03:18 UTC
From:
To:
Ah, I didn't notice the * on the <hname> line - my bad

Not according to the original specification:

http://www.ietf.org/rfc/rfc1034.txt

But according to a later RFC:

http://www.ietf.org/rfc/rfc2181.txt

I've read that some of the IDNA rfcs added i18n for hostnames too which
resulted in making "_" legal there too but I couldn't find that anywhere

Enabling HTTPProtocolOptions unsafe on the virtualhost doesn't work so
you need to enable it on the global apache config - and the
documentation notes it's "strongly cautioned against"

But arguing over the interpretation of different specifications is
unimportant - as you mentioned underscores are widely in use right now,
and as Ondrej agreed it's a bad idea to have such a huge breaking change
whether it's intended or not.

#851357#40
Date:
2017-01-14 18:36:34 UTC
From:
To:
Stefan,

JFTR underscores in domain names are allowed, just not for hostnames. SRV,
TLSA and other RRs make use of them.

O.

#851357#45
Date:
2017-01-14 19:18:37 UTC
From:
To:
of a host. From RFC1035 section 2.3.1 (a FQDN consists of multiple labels
separated by dots):

  The labels must follow the rules for ARPANET host names.  They must
  start with a letter, end with a letter or digit, and have as interior
  characters only letters, digits, and hyphen.  There are also some
  restrictions on the length.  Labels must be 63 characters or less.

For example, while TLSA uses things like _tcp and _443 in the looked up RRs,
its spec RFC  6698 section 3 explicitly states that the labels in the "base
domain name" must meet the restrictions from RFC 952, which means no
underscores.

And for http/https, only hostnames are relevant. Even if they look like a
domain name like heise.de.

Jonathan, So , host/domain names with underscores are not RFC compliant even
though they are common in internal networks. And I looked up some discussions
on the upstream httpd-dev list and consensus was that they wanted only a
single knob to switch to legacy behavior. Though underscores in domain names
were not discussed explicitly.

Also interesting: RFC 7230 section 5.4 says that a http server must respond
with "400 bad request" if the Host header field contains an invalid field-value
(though it does not define "invalid" explicitly).

#851357#50
Date:
2017-02-12 10:13:37 UTC
From:
To:
tags 851357 wontfix
thanks


Upstream does not intend to change this behavior. See the thread starting at

http://mail-archives.apache.org/mod_mbox/httpd-dev/201702.mbox/
%3C20170202125319.GA15948%40redhat.com%3E

I won't deviate from upstream in the Debian 9 squeeze release, but I will
allow underscores in the upcoming DSA for jessie.

People who need underscores will have to resort to 'HTTPProtocolOptions
unsafe'.

#851357#57
Date:
2018-02-02 22:27:13 UTC
From:
To:
Hamaavgan@gemail.com
#851357#62
Date:
2019-06-17 07:37:50 UTC
From:
To:
Hello,

Our partners referred your company to us. Regarding your great products.
Please see required products, quantity and specifications as attached.

Kindly give us your lowest possible prices for FCL shipment.


Best Regards,

Wanda Rodriguez
Purchase Assistant

Hidroconta Trading Ltd.
Av. de Sta. Catalina,
60, 30012 Murcia, Spain
Phone: +34 968 26 77 66
Fax: +34 968 26 77 06

#851357#67
Date:
2020-05-10 08:34:21 UTC
From:
To:
Good day,

My associate from China wants to discuss a business investment deal with
you. I awaiting your response to enable us discuss about this business
investment

Nael M. Al Homoud
Executive Director & High Investment Committee Member@
The Arab Investment Co
www.taic.com [1]



Links:
------
[1] http://www.taic.com

#851357#72
Date:
2020-06-21 13:48:52 UTC
From:
To:

#851357#77
Date:
2021-09-24 07:40:18 UTC
From:
To:
Dzień dobry,

kontaktuję się z Państwem, ponieważ dostrzegam możliwość redukcji opłat za prąd.

Odpowiednio dobrana instalacja fotowoltaiczna to rozwiązanie, które pozwala wygenerować spore oszczędności w skali roku.

Chciałbym porozmawiać z Państwem o tego typu rozwiązaniu, a także przedstawić wstępne kalkulacje.

Czy są Państwo zainteresowani?

Pozdrawiam,
Dorian Kwiatkowski

#851357#82
Date:
2021-10-13 07:41:05 UTC
From:
To:
Dzień dobry,

jakiś czas temu zgłosiła się do nas firma, której strona internetowa nie pozycjonowała się wysoko w wyszukiwarce Google.

Na podstawie wykonanego przez nas audytu SEO zoptymalizowaliśmy treści na stronie pod kątem wcześniej opracowanych słów kluczowych. Nasz wewnętrzny system codziennie analizuje prawidłowe działanie witryny.  Dzięki indywidualnej strategii, firma zdobywa coraz więcej Klientów.

Czy chcieliby Państwo zwiększyć liczbę osób odwiedzających stronę internetową firmy? Mógłbym przedstawić ofertę?


Pozdrawiam serdecznie,
Patryk Górecki

#851357#87
Date:
2021-10-20 07:30:24 UTC
From:
To:
Dzień dobry,

jakiś czas temu zgłosiła się do nas firma, której strona internetowa nie pozycjonowała się wysoko w wyszukiwarce Google.

Na podstawie wykonanego przez nas audytu SEO zoptymalizowaliśmy treści na stronie pod kątem wcześniej opracowanych słów kluczowych. Nasz wewnętrzny system codziennie analizuje prawidłowe działanie witryny.  Dzięki indywidualnej strategii, firma zdobywa coraz więcej Klientów.

Czy chcieliby Państwo zwiększyć liczbę osób odwiedzających stronę internetową firmy? Mógłbym przedstawić ofertę?


Pozdrawiam serdecznie,
Patryk Górecki

#851357#92
Date:
2021-11-16 08:35:26 UTC
From:
To:
Dzień dobry!

Czy mógłbym przedstawić rozwiązanie, które umożliwia monitoring każdego auta w czasie rzeczywistym w tym jego pozycję, zużycie paliwa i przebieg?

Dodatkowo nasze narzędzie minimalizuje koszty utrzymania samochodów, skraca czas przejazdów, a także tworzenie planu tras czy dostaw.

Z naszej wiedzy i doświadczenia korzysta już ponad 49 tys. Klientów. Monitorujemy 809 000 pojazdów na całym świecie, co jest naszą najlepszą wizytówką.

Bardzo proszę o e-maila zwrotnego, jeśli moglibyśmy wspólnie omówić potencjał wykorzystania takiego rozwiązania w Państwa firmie.


Z poważaniem,
Dawid Rowicki

#851357#97
Date:
2021-12-14 08:30:11 UTC
From:
To:
Dzień dobry,

zapoznałem się z Państwa ofertą i z przyjemnością przyznaję, że przyciąga uwagę i zachęca do dalszych rozmów.

Pomyślałem, że może mógłbym mieć swój wkład w Państwa rozwój i pomóc dotrzeć z tą ofertą do większego grona odbiorców. Pozycjonuję strony www, dzięki czemu generują świetny ruch w sieci.

Możemy porozmawiać w najbliższym czasie?


Pozdrawiam
Adam Furgalski

#851357#102
Date:
2021-12-14 08:40:33 UTC
From:
To:
Dzień dobry,

kontaktuje się z Państwem, ponieważ jako osoba zajmująca się usprawnieniem procesów, chciałbym zaprezentować nowoczesne rozwiązanie dla Państwa firmy.

System został stworzony z myślą o przedsiębiorstwach z sektora MŚP, aby zapewnić bezpieczeństwo danych, niezawodność i optymalizację procesów. Dzięki bogatym funkcjonalnościom usprawnia i przyspiesza obsługę zleceń.

Jeśli chcieliby Państwo zwiększyć tempo rozwoju swojej działalności i poszerzyć rynek zbytu chętnie opowiem więcej. Kiedy mogę się skontaktować?


Pozdrawiam,
Arkadiusz Stryj