mirror of
https://github.com/nginx/nginx.git
synced 2026-08-27 04:07:18 +00:00
SNI: reset to default server if requested host was not found.
Not only this is consistent with a case without SNI, but this also
prevents abusing configurations that assume that the $host variable
is limited to one of the configured names for a server.
An example of potentially unsafe configuration:
server {
listen 443 ssl default_server;
...
}
server {
listen 443;
server_name example.com;
location / {
proxy_pass http://$host;
}
}
Note: it is possible to negotiate "example.com" by SNI, and to request
arbitrary host name that does not exist in the configuration above.
This commit is contained in:
parent
f61612532c
commit
6000f4ad6d
1 changed files with 11 additions and 0 deletions
|
|
@ -1869,6 +1869,17 @@ ngx_http_set_virtual_server(ngx_http_request_t *r, ngx_str_t *host)
|
|||
return NGX_ERROR;
|
||||
}
|
||||
|
||||
#ifdef SSL_CTRL_SET_TLSEXT_HOSTNAME
|
||||
|
||||
if (hc->ssl_servername) {
|
||||
if (rc == NGX_DECLINED) {
|
||||
cscf = hc->addr_conf->default_server;
|
||||
rc = NGX_OK;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
if (rc == NGX_DECLINED) {
|
||||
return NGX_OK;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue