Yann Ylavic wrote:
> There seem to be different questions in this thread regarding SNI.
> Maybe we can enumerate them first to see what's going on (at least I need to)
> 
> 1. What should the client-provided SNI be checked against?
> 1.1. for server or proxy-reverse
> 1.2. for proxy-forward/CONNECT
> 
> Possibilities are :
> 1.a. Host: header
> 1.b. Request-URI's hostname
> 1.c. ServerName/ServerAlias(es)
> 1.d. ap_get_server_name_for_url()
> 1.e. none
> 
> 2. What should the proxy-provided SNI be?
> 2.1. when ProxyPreserveHost is off
> 2.2. when ProxyPreserveHost is on
> 
> Possibilities are :
> 2.a. proxy worker's hostname
> 2.b. r->hostname
> 2.c. Host: header (being sent)
> 
> 3. What should the backend's CN be checked against?
> 
> 4. How should the proxy reuse SNI connections?
> 
> Currently :
> 1.1 => 1.b if any, otherwise 1.a
> 1.2 => 1.e
> 2.1 => 2.a
> 2.2 => 2.b
> 3 => the proxy-provided SNI (or wildcard match)
> 4 => always
> 
> 
> I propose to use the following instead :
> 
> 1.1 => 1.d
> So that the admin can configure UseCanonicalName to branch 1.b-a or 1.c.

Host header and SNI should be consistent IMHO. So I think the current setup is 
correct.

> 
> 1.2 => 1.b
> It seems that the client-provided SNI is the requested backend (not
> the proxy), although I may be wrong.

Keep in mind that 1.e is only the current state on trunk and SNI checking IMHO 
makes no sense in the 1.2 case
as it cannot be used for virtual host selection on our side. This information 
is for the proxied side.

> 
> 2.1 => 2.c
> 2.2 => 2.c
> Both should use the Host: header since this is what the backend will check.
> Either the Host: is legitimate and we can forward it, or it should be
> denied by the proxy before forwarding (that's kind of hot potato sent
> to the backend otherwise).

I strongly disagree. In the 2.1 case we need to set the host header and SNI 
(provided no IP) as requested
by the admin. This configuration is usually on purpose and takes into account 
that the internal servers have
different DNS names and a matching certificate / virtual host setup.
Regarding 2.2 I think that 2.b is still the correct choice as we use a 
sanitized and normalized version of the
host header here.

> 
> 3 => the proxy-provided SNI (or wildcard match)
> Same as currently, but now this is really what was requested, whatever
> ProxyPreserveHost is.
> The SubjectAltName(s) should be used too.

ProxyCheckPeerName should do this already.

> 
> 4 => compare reusable connection's hostname with 2.c (when conn->is_ssl only)

This could be a worthwhile idea and I have seen your patch in bugzilla.
For ease of commenting I would like you to post it here such that inline 
comments could
be made (I would have some).

Regards

Rüdiger

Reply via email to