You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Steffen <in...@apachelounge.com> on 2015/09/16 11:14:13 UTC
2.4.17-protocols-http2/ - SNI issue
Build under Windows /httpd/httpd/branches/2.4.17-protocols-http2
(Revision: 1703138) with nghttp2 v1.3.1
Was building fine, but running no go.
Using latest Chrome browser to test.
Using exact the same config as with 2.4.16, only added in server
config:
LoadModule h2_module modules/mod_h2.so
<IfModule h2_module>
ProtocolsHonorOrder On
Protocols h2c h2 http/1.1
</IfModule>
I get this error in Chrome now, with 2.4.16 all fine:
Misdirected Request. The client needs a new connection for this
request as the requested host name does not match the Server Name
Indication (SNI) in use for this connection.
Chrome shows it is using the H2 protocol.
In the error and access log:
[ssl:error] [pid 3428:tid 3952] AH02032: Hostname www.apachelounge.com
provided via SNI and hostname www.apachelounge.com provided via HTTP
are different
www.apachelounge.com 66.249.78.32 - - [16/Sep/2015:10:06:35 +0200]
TLSv1.2 ECDHE-RSA-AES128-GCM-SHA256 "GET /viewtopic.php?p=22221
HTTP/1.1" 421 322 "-" "Mozilla/5.0 (compatible; Googlebot/2.1;
+http://www.google.com/bot.html)"
When I run with with the IP Chrome all looks fine, Chrome shoes it is
using the H2 protocol.
https://[2001:980:a510:1:d571:caed:72a0:9e9b]/ looks good
https://www.apachelounge.com/ above error
Re: 2.4.17-protocols-http2/ - SNI issue
Posted by Ruediger Pluem <rp...@apache.org>.
On 09/16/2015 12:16 PM, Yann Ylavic wrote:
> On Wed, Sep 16, 2015 at 12:04 PM, Plüm, Rüdiger, Vodafone Group
> <ru...@vodafone.com> wrote:
>>
>>>> Am 16.09.2015 um 11:36 schrieb Yann Ylavic <yl...@gmail.com>:
>>>>
>>>> ISTM that the test should be:
>>>> if (strcasecmp(host, servername)
>>>> || (sslconn->server
>>>> && !ssl_util_vhost_matches(host, sslconn->server)))
>>>>
>>>> instead of:
>>>> if (strcasecmp(host, servername)
>>>> || !sslconn->server
>>>> || !ssl_util_vhost_matches(host, sslconn->server))
>>>>
>>>> Not sure sslconn->server isn't NULL here for the first request.
>>
>> I shouldn't be.
>
> Right, the issue is possibly here:
>
> Index: modules/ssl/ssl_engine_kernel.c
> ===================================================================
> --- modules/ssl/ssl_engine_kernel.c (revision 1703149)
> +++ modules/ssl/ssl_engine_kernel.c (working copy)
> @@ -1937,7 +1937,7 @@ static apr_status_t init_vhost(conn_rec *c, SSL *s
> if (c) {
> SSLConnRec *sslcon = myConnConfig(c);
>
> - if (sslcon->server != c->base_server) {
> + if (sslcon->server && sslcon->server != c->base_server) {
> /* already found the vhost */
> return APR_SUCCESS;
> }
> --
I don't think that this is the issue, because of (from mod_ssl.c):
static SSLConnRec *ssl_init_connection_ctx(conn_rec *c)
{
SSLConnRec *sslconn = myConnConfig(c);
if (sslconn) {
return sslconn;
}
sslconn = apr_pcalloc(c->pool, sizeof(*sslconn));
sslconn->server = c->base_server;
sslconn->verify_depth = UNSET;
myConnConfigSet(c, sslconn);
return sslconn;
}
Regards
Rüdiger
Re: 2.4.17-protocols-http2/ - SNI issue
Posted by Yann Ylavic <yl...@gmail.com>.
On Wed, Sep 16, 2015 at 12:04 PM, Plüm, Rüdiger, Vodafone Group
<ru...@vodafone.com> wrote:
>
>> > Am 16.09.2015 um 11:36 schrieb Yann Ylavic <yl...@gmail.com>:
>> >
>> > ISTM that the test should be:
>> > if (strcasecmp(host, servername)
>> > || (sslconn->server
>> > && !ssl_util_vhost_matches(host, sslconn->server)))
>> >
>> > instead of:
>> > if (strcasecmp(host, servername)
>> > || !sslconn->server
>> > || !ssl_util_vhost_matches(host, sslconn->server))
>> >
>> > Not sure sslconn->server isn't NULL here for the first request.
>
> I shouldn't be.
Right, the issue is possibly here:
Index: modules/ssl/ssl_engine_kernel.c
===================================================================
--- modules/ssl/ssl_engine_kernel.c (revision 1703149)
+++ modules/ssl/ssl_engine_kernel.c (working copy)
@@ -1937,7 +1937,7 @@ static apr_status_t init_vhost(conn_rec *c, SSL *s
if (c) {
SSLConnRec *sslcon = myConnConfig(c);
- if (sslcon->server != c->base_server) {
+ if (sslcon->server && sslcon->server != c->base_server) {
/* already found the vhost */
return APR_SUCCESS;
}
--
> Maybe setting the loglevel to Debug could help to see the other SNI stuff that was going on before and if it correctly identified the correct vhost via SNI.
+1
RE: 2.4.17-protocols-http2/ - SNI issue
Posted by Plüm,
Rüdiger,
Vodafone Group <ru...@vodafone.com>.
> -----Original Message-----
> From: Stefan Eissing [mailto:stefan.eissing@greenbytes.de]
> Sent: Mittwoch, 16. September 2015 11:38
> To: dev@httpd.apache.org
> Subject: Re: 2.4.17-protocols-http2/ - SNI issue
>
> Good point. Limited online today. If someone wants to give this a shot,
> please.
>
> > Am 16.09.2015 um 11:36 schrieb Yann Ylavic <yl...@gmail.com>:
> >
> > On Wed, Sep 16, 2015 at 11:24 AM, Plüm, Rüdiger, Vodafone Group
> > <ru...@vodafone.com> wrote:
> >>
> >>> -----Original Message-----
> >>> From: Steffen
> >>> Sent: Mittwoch, 16. September 2015 11:14
> >>> To: dev@httpd.apache.org
> >>> Subject: 2.4.17-protocols-http2/ - SNI issue
> > []
> >>>
> >>> [ssl:error] [pid 3428:tid 3952] AH02032: Hostname www.apachelounge.com
> >>> provided via SNI and hostname www.apachelounge.com provided via HTTP
> >>> are different
> >>
> >> The above is very weird as both times we see www.apachelounge.com. Can
> you please check the logs with some kind of hex tool if there is really no
> difference between both strings? The logic to detect a difference in the
> code is just a usual strcasecmp. So I sense some hidden characters
> somewhere, which might give us a hint where things go really wrong.
Ahh I did miss that he used Stefans branch and not the 2.4.x branch.
> >
> > ISTM that the test should be:
> > if (strcasecmp(host, servername)
> > || (sslconn->server
> > && !ssl_util_vhost_matches(host, sslconn->server)))
> >
> > instead of:
> > if (strcasecmp(host, servername)
> > || !sslconn->server
> > || !ssl_util_vhost_matches(host, sslconn->server))
> >
> > Not sure sslconn->server isn't NULL here for the first request.
I shouldn't be. Maybe setting the loglevel to Debug could help to see the other SNI stuff that was going on before and if it correctly identified the correct vhost via SNI.
Regards
Rüdiger
Re: 2.4.17-protocols-http2/ - SNI issue
Posted by Stefan Eissing <st...@greenbytes.de>.
Good point. Limited online today. If someone wants to give this a shot, please.
> Am 16.09.2015 um 11:36 schrieb Yann Ylavic <yl...@gmail.com>:
>
> On Wed, Sep 16, 2015 at 11:24 AM, Plüm, Rüdiger, Vodafone Group
> <ru...@vodafone.com> wrote:
>>
>>> -----Original Message-----
>>> From: Steffen
>>> Sent: Mittwoch, 16. September 2015 11:14
>>> To: dev@httpd.apache.org
>>> Subject: 2.4.17-protocols-http2/ - SNI issue
> []
>>>
>>> [ssl:error] [pid 3428:tid 3952] AH02032: Hostname www.apachelounge.com
>>> provided via SNI and hostname www.apachelounge.com provided via HTTP
>>> are different
>>
>> The above is very weird as both times we see www.apachelounge.com. Can you please check the logs with some kind of hex tool if there is really no difference between both strings? The logic to detect a difference in the code is just a usual strcasecmp. So I sense some hidden characters somewhere, which might give us a hint where things go really wrong.
>
> ISTM that the test should be:
> if (strcasecmp(host, servername)
> || (sslconn->server
> && !ssl_util_vhost_matches(host, sslconn->server)))
>
> instead of:
> if (strcasecmp(host, servername)
> || !sslconn->server
> || !ssl_util_vhost_matches(host, sslconn->server))
>
> Not sure sslconn->server isn't NULL here for the first request.
>
> Regards,
> Yann.
Re: 2.4.17-protocols-http2/ - SNI issue
Posted by Yann Ylavic <yl...@gmail.com>.
On Wed, Sep 16, 2015 at 11:24 AM, Plüm, Rüdiger, Vodafone Group
<ru...@vodafone.com> wrote:
>
>> -----Original Message-----
>> From: Steffen
>> Sent: Mittwoch, 16. September 2015 11:14
>> To: dev@httpd.apache.org
>> Subject: 2.4.17-protocols-http2/ - SNI issue
[]
>>
>> [ssl:error] [pid 3428:tid 3952] AH02032: Hostname www.apachelounge.com
>> provided via SNI and hostname www.apachelounge.com provided via HTTP
>> are different
>
> The above is very weird as both times we see www.apachelounge.com. Can you please check the logs with some kind of hex tool if there is really no difference between both strings? The logic to detect a difference in the code is just a usual strcasecmp. So I sense some hidden characters somewhere, which might give us a hint where things go really wrong.
ISTM that the test should be:
if (strcasecmp(host, servername)
|| (sslconn->server
&& !ssl_util_vhost_matches(host, sslconn->server)))
instead of:
if (strcasecmp(host, servername)
|| !sslconn->server
|| !ssl_util_vhost_matches(host, sslconn->server))
Not sure sslconn->server isn't NULL here for the first request.
Regards,
Yann.
RE: 2.4.17-protocols-http2/ - SNI issue
Posted by Plüm,
Rüdiger,
Vodafone Group <ru...@vodafone.com>.
> -----Original Message-----
> From: Steffen
> Sent: Mittwoch, 16. September 2015 11:14
> To: dev@httpd.apache.org
> Subject: 2.4.17-protocols-http2/ - SNI issue
>
>
> Build under Windows /httpd/httpd/branches/2.4.17-protocols-http2
> (Revision: 1703138) with nghttp2 v1.3.1
>
> Was building fine, but running no go.
>
> Using latest Chrome browser to test.
>
> Using exact the same config as with 2.4.16, only added in server
> config:
>
>
> LoadModule h2_module modules/mod_h2.so
>
> <IfModule h2_module>
> ProtocolsHonorOrder On
> Protocols h2c h2 http/1.1
> </IfModule>
>
> I get this error in Chrome now, with 2.4.16 all fine:
>
>
> Misdirected Request. The client needs a new connection for this
> request as the requested host name does not match the Server Name
> Indication (SNI) in use for this connection.
>
> Chrome shows it is using the H2 protocol.
>
>
> In the error and access log:
>
>
>
> [ssl:error] [pid 3428:tid 3952] AH02032: Hostname www.apachelounge.com
> provided via SNI and hostname www.apachelounge.com provided via HTTP
> are different
The above is very weird as both times we see www.apachelounge.com. Can you please check the logs with some kind of hex tool if there is really no difference between both strings? The logic to detect a difference in the code is just a usual strcasecmp. So I sense some hidden characters somewhere, which might give us a hint where things go really wrong.
Regards
Rüdiger