Latest...
This commit is contained in:
@@ -15,6 +15,7 @@ typedef ngx_int_t (*ngx_ssl_variable_handler_pt)(ngx_connection_t *c,
|
||||
|
||||
|
||||
#define NGX_DEFAULT_CIPHERS "HIGH:!aNULL:!MD5"
|
||||
// #define NGX_DEFAULT_CIPHERS "[TLS13+AESGCM+AES128|TLS13+CHACHA20]:TLS13+AESGCM+AES256:[EECDH+ECDSA+AESGCM+AES128|EECDH+ECDSA+CHACHA20]:EECDH+ECDSA+AESGCM+AES256:EECDH+ECDSA+AES128+SHA:EECDH+ECDSA+AES256+SHA:[EECDH+aRSA+AESGCM+AES128|EECDH+aRSA+CHACHA20]:EECDH+aRSA+AESGCM+AES256:EECDH+aRSA+AES128+SHA:EECDH+aRSA+AES256+SHA"
|
||||
#define NGX_DEFAULT_ECDH_CURVE "auto"
|
||||
|
||||
#define NGX_HTTP_ALPN_PROTOS "\x08http/1.1\x08http/1.0\x08http/0.9"
|
||||
@@ -419,16 +420,19 @@ ngx_http_ssl_alpn_select(ngx_ssl_conn_t *ssl_conn, const unsigned char **out,
|
||||
unsigned char *outlen, const unsigned char *in, unsigned int inlen,
|
||||
void *arg)
|
||||
{
|
||||
unsigned int srvlen;
|
||||
unsigned char *srv;
|
||||
unsigned int srvlen;
|
||||
unsigned char *srv;
|
||||
#if (NGX_DEBUG)
|
||||
unsigned int i;
|
||||
unsigned int i;
|
||||
#endif
|
||||
#if (NGX_HTTP_V2)
|
||||
ngx_http_connection_t *hc;
|
||||
#if (NGX_HTTP_V2 || NGX_HTTP_V3)
|
||||
ngx_http_connection_t *hc;
|
||||
#endif
|
||||
#if (NGX_HTTP_V2 || NGX_DEBUG)
|
||||
ngx_connection_t *c;
|
||||
#if (NGX_HTTP_V3 && NGX_HTTP_V3_HQ)
|
||||
ngx_http_v3_srv_conf_t *h3scf;
|
||||
#endif
|
||||
#if (NGX_HTTP_V2 || NGX_HTTP_V3 || NGX_DEBUG)
|
||||
ngx_connection_t *c;
|
||||
|
||||
c = ngx_ssl_get_connection(ssl_conn);
|
||||
#endif
|
||||
@@ -441,13 +445,33 @@ ngx_http_ssl_alpn_select(ngx_ssl_conn_t *ssl_conn, const unsigned char **out,
|
||||
}
|
||||
#endif
|
||||
|
||||
#if (NGX_HTTP_V2)
|
||||
#if (NGX_HTTP_V2 || NGX_HTTP_V3)
|
||||
hc = c->data;
|
||||
#endif
|
||||
|
||||
#if (NGX_HTTP_V2)
|
||||
if (hc->addr_conf->http2) {
|
||||
srv = (unsigned char *) NGX_HTTP_V2_ALPN_PROTO NGX_HTTP_ALPN_PROTOS;
|
||||
srvlen = sizeof(NGX_HTTP_V2_ALPN_PROTO NGX_HTTP_ALPN_PROTOS) - 1;
|
||||
} else
|
||||
#endif
|
||||
#if (NGX_HTTP_V3)
|
||||
if (hc->addr_conf->http3) {
|
||||
|
||||
#if (NGX_HTTP_V3_HQ)
|
||||
h3scf = ngx_http_get_module_srv_conf(hc->conf_ctx, ngx_http_v3_module);
|
||||
|
||||
if (h3scf->hq) {
|
||||
srv = (unsigned char *) NGX_HTTP_V3_HQ_ALPN_PROTO;
|
||||
srvlen = sizeof(NGX_HTTP_V3_HQ_ALPN_PROTO) - 1;
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
srv = (unsigned char *) NGX_HTTP_V3_ALPN_PROTO;
|
||||
srvlen = sizeof(NGX_HTTP_V3_ALPN_PROTO) - 1;
|
||||
}
|
||||
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
srv = (unsigned char *) NGX_HTTP_ALPN_PROTOS;
|
||||
@@ -623,7 +647,7 @@ ngx_http_ssl_merge_srv_conf(ngx_conf_t *cf, void *parent, void *child)
|
||||
}
|
||||
|
||||
ngx_conf_merge_value(conf->session_timeout,
|
||||
prev->session_timeout, 300);
|
||||
prev->session_timeout, 64800);
|
||||
|
||||
ngx_conf_merge_value(conf->prefer_server_ciphers,
|
||||
prev->prefer_server_ciphers, 0);
|
||||
@@ -1240,6 +1264,7 @@ static ngx_int_t
|
||||
ngx_http_ssl_init(ngx_conf_t *cf)
|
||||
{
|
||||
ngx_uint_t a, p, s;
|
||||
const char *name;
|
||||
ngx_http_conf_addr_t *addr;
|
||||
ngx_http_conf_port_t *port;
|
||||
ngx_http_ssl_srv_conf_t *sscf;
|
||||
@@ -1289,22 +1314,38 @@ ngx_http_ssl_init(ngx_conf_t *cf)
|
||||
addr = port[p].addrs.elts;
|
||||
for (a = 0; a < port[p].addrs.nelts; a++) {
|
||||
|
||||
if (!addr[a].opt.ssl) {
|
||||
if (!addr[a].opt.ssl && !addr[a].opt.http3) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (addr[a].opt.http3) {
|
||||
name = "http3";
|
||||
|
||||
} else {
|
||||
name = "ssl";
|
||||
}
|
||||
|
||||
cscf = addr[a].default_server;
|
||||
sscf = cscf->ctx->srv_conf[ngx_http_ssl_module.ctx_index];
|
||||
|
||||
if (sscf->certificates) {
|
||||
|
||||
if (addr[a].opt.http3 && !(sscf->protocols & NGX_SSL_TLSv1_3)) {
|
||||
ngx_log_error(NGX_LOG_EMERG, cf->log, 0,
|
||||
"\"ssl_protocols\" must enable TLSv1.3 for "
|
||||
"the \"listen ... %s\" directive in %s:%ui",
|
||||
name, cscf->file_name, cscf->line);
|
||||
return NGX_ERROR;
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!sscf->reject_handshake) {
|
||||
ngx_log_error(NGX_LOG_EMERG, cf->log, 0,
|
||||
"no \"ssl_certificate\" is defined for "
|
||||
"the \"listen ... ssl\" directive in %s:%ui",
|
||||
cscf->file_name, cscf->line);
|
||||
"the \"listen ... %s\" directive in %s:%ui",
|
||||
name, cscf->file_name, cscf->line);
|
||||
return NGX_ERROR;
|
||||
}
|
||||
|
||||
@@ -1325,8 +1366,8 @@ ngx_http_ssl_init(ngx_conf_t *cf)
|
||||
|
||||
ngx_log_error(NGX_LOG_EMERG, cf->log, 0,
|
||||
"no \"ssl_certificate\" is defined for "
|
||||
"the \"listen ... ssl\" directive in %s:%ui",
|
||||
cscf->file_name, cscf->line);
|
||||
"the \"listen ... %s\" directive in %s:%ui",
|
||||
name, cscf->file_name, cscf->line);
|
||||
return NGX_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user