mirror of
https://github.com/nginx/nginx.git
synced 2024-11-23 20:19:02 +08:00
SSL: a new macro to set default protocol versions.
Some checks failed
buildbot / buildbot (push) Has been cancelled
Some checks failed
buildbot / buildbot (push) Has been cancelled
This simplifies merging protocol values afterea15896
andebd18ec
. Further, as outlined inebd18ec18
, for libraries preceeding TLSv1.2+ support, only meaningful versions TLSv1 and TLSv1.1 are set by default. While here, fixed indentation.
This commit is contained in:
parent
569948aa12
commit
476d6526b2
@ -187,6 +187,13 @@ typedef struct {
|
|||||||
#define NGX_SSL_TLSv1_3 0x0040
|
#define NGX_SSL_TLSv1_3 0x0040
|
||||||
|
|
||||||
|
|
||||||
|
#if (defined SSL_OP_NO_TLSv1_2 || defined SSL_OP_NO_TLSv1_3)
|
||||||
|
#define NGX_SSL_DEFAULT_PROTOCOLS (NGX_SSL_TLSv1_2|NGX_SSL_TLSv1_3)
|
||||||
|
#else
|
||||||
|
#define NGX_SSL_DEFAULT_PROTOCOLS (NGX_SSL_TLSv1|NGX_SSL_TLSv1_1)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#define NGX_SSL_BUFFER 1
|
#define NGX_SSL_BUFFER 1
|
||||||
#define NGX_SSL_CLIENT 2
|
#define NGX_SSL_CLIENT 2
|
||||||
|
|
||||||
|
@ -4475,16 +4475,8 @@ ngx_http_grpc_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
|
|||||||
ngx_conf_merge_value(conf->upstream.ssl_session_reuse,
|
ngx_conf_merge_value(conf->upstream.ssl_session_reuse,
|
||||||
prev->upstream.ssl_session_reuse, 1);
|
prev->upstream.ssl_session_reuse, 1);
|
||||||
|
|
||||||
#ifndef SSL_OP_NO_TLSv1_2
|
|
||||||
ngx_conf_merge_bitmask_value(conf->ssl_protocols, prev->ssl_protocols,
|
ngx_conf_merge_bitmask_value(conf->ssl_protocols, prev->ssl_protocols,
|
||||||
(NGX_CONF_BITMASK_SET
|
(NGX_CONF_BITMASK_SET|NGX_SSL_DEFAULT_PROTOCOLS));
|
||||||
|NGX_SSL_TLSv1|NGX_SSL_TLSv1_1
|
|
||||||
|NGX_SSL_TLSv1_2|NGX_SSL_TLSv1_3));
|
|
||||||
#else
|
|
||||||
ngx_conf_merge_bitmask_value(conf->ssl_protocols, prev->ssl_protocols,
|
|
||||||
(NGX_CONF_BITMASK_SET
|
|
||||||
|NGX_SSL_TLSv1_2|NGX_SSL_TLSv1_3));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
ngx_conf_merge_str_value(conf->ssl_ciphers, prev->ssl_ciphers,
|
ngx_conf_merge_str_value(conf->ssl_ciphers, prev->ssl_ciphers,
|
||||||
"DEFAULT");
|
"DEFAULT");
|
||||||
|
@ -3942,16 +3942,8 @@ ngx_http_proxy_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
|
|||||||
ngx_conf_merge_value(conf->upstream.ssl_session_reuse,
|
ngx_conf_merge_value(conf->upstream.ssl_session_reuse,
|
||||||
prev->upstream.ssl_session_reuse, 1);
|
prev->upstream.ssl_session_reuse, 1);
|
||||||
|
|
||||||
#ifndef SSL_OP_NO_TLSv1_2
|
|
||||||
ngx_conf_merge_bitmask_value(conf->ssl_protocols, prev->ssl_protocols,
|
ngx_conf_merge_bitmask_value(conf->ssl_protocols, prev->ssl_protocols,
|
||||||
(NGX_CONF_BITMASK_SET
|
(NGX_CONF_BITMASK_SET|NGX_SSL_DEFAULT_PROTOCOLS));
|
||||||
|NGX_SSL_TLSv1|NGX_SSL_TLSv1_1
|
|
||||||
|NGX_SSL_TLSv1_2|NGX_SSL_TLSv1_3));
|
|
||||||
#else
|
|
||||||
ngx_conf_merge_bitmask_value(conf->ssl_protocols, prev->ssl_protocols,
|
|
||||||
(NGX_CONF_BITMASK_SET
|
|
||||||
|NGX_SSL_TLSv1_2|NGX_SSL_TLSv1_3));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
ngx_conf_merge_str_value(conf->ssl_ciphers, prev->ssl_ciphers,
|
ngx_conf_merge_str_value(conf->ssl_ciphers, prev->ssl_ciphers,
|
||||||
"DEFAULT");
|
"DEFAULT");
|
||||||
|
@ -651,16 +651,8 @@ ngx_http_ssl_merge_srv_conf(ngx_conf_t *cf, void *parent, void *child)
|
|||||||
ngx_conf_merge_value(conf->early_data, prev->early_data, 0);
|
ngx_conf_merge_value(conf->early_data, prev->early_data, 0);
|
||||||
ngx_conf_merge_value(conf->reject_handshake, prev->reject_handshake, 0);
|
ngx_conf_merge_value(conf->reject_handshake, prev->reject_handshake, 0);
|
||||||
|
|
||||||
#ifndef SSL_OP_NO_TLSv1_2
|
|
||||||
ngx_conf_merge_bitmask_value(conf->protocols, prev->protocols,
|
ngx_conf_merge_bitmask_value(conf->protocols, prev->protocols,
|
||||||
(NGX_CONF_BITMASK_SET
|
(NGX_CONF_BITMASK_SET|NGX_SSL_DEFAULT_PROTOCOLS));
|
||||||
|NGX_SSL_TLSv1|NGX_SSL_TLSv1_1
|
|
||||||
|NGX_SSL_TLSv1_2|NGX_SSL_TLSv1_3));
|
|
||||||
#else
|
|
||||||
ngx_conf_merge_bitmask_value(conf->protocols, prev->protocols,
|
|
||||||
(NGX_CONF_BITMASK_SET
|
|
||||||
|NGX_SSL_TLSv1_2|NGX_SSL_TLSv1_3));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
ngx_conf_merge_size_value(conf->buffer_size, prev->buffer_size,
|
ngx_conf_merge_size_value(conf->buffer_size, prev->buffer_size,
|
||||||
NGX_SSL_BUFSIZE);
|
NGX_SSL_BUFSIZE);
|
||||||
|
@ -1899,16 +1899,8 @@ ngx_http_uwsgi_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
|
|||||||
ngx_conf_merge_value(conf->upstream.ssl_session_reuse,
|
ngx_conf_merge_value(conf->upstream.ssl_session_reuse,
|
||||||
prev->upstream.ssl_session_reuse, 1);
|
prev->upstream.ssl_session_reuse, 1);
|
||||||
|
|
||||||
#ifndef SSL_OP_NO_TLSv1_2
|
|
||||||
ngx_conf_merge_bitmask_value(conf->ssl_protocols, prev->ssl_protocols,
|
ngx_conf_merge_bitmask_value(conf->ssl_protocols, prev->ssl_protocols,
|
||||||
(NGX_CONF_BITMASK_SET
|
(NGX_CONF_BITMASK_SET|NGX_SSL_DEFAULT_PROTOCOLS));
|
||||||
|NGX_SSL_TLSv1|NGX_SSL_TLSv1_1
|
|
||||||
|NGX_SSL_TLSv1_2|NGX_SSL_TLSv1_3));
|
|
||||||
#else
|
|
||||||
ngx_conf_merge_bitmask_value(conf->ssl_protocols, prev->ssl_protocols,
|
|
||||||
(NGX_CONF_BITMASK_SET
|
|
||||||
|NGX_SSL_TLSv1_2|NGX_SSL_TLSv1_3));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
ngx_conf_merge_str_value(conf->ssl_ciphers, prev->ssl_ciphers,
|
ngx_conf_merge_str_value(conf->ssl_ciphers, prev->ssl_ciphers,
|
||||||
"DEFAULT");
|
"DEFAULT");
|
||||||
|
@ -343,16 +343,8 @@ ngx_mail_ssl_merge_conf(ngx_conf_t *cf, void *parent, void *child)
|
|||||||
ngx_conf_merge_value(conf->prefer_server_ciphers,
|
ngx_conf_merge_value(conf->prefer_server_ciphers,
|
||||||
prev->prefer_server_ciphers, 0);
|
prev->prefer_server_ciphers, 0);
|
||||||
|
|
||||||
#ifndef SSL_OP_NO_TLSv1_2
|
|
||||||
ngx_conf_merge_bitmask_value(conf->protocols, prev->protocols,
|
ngx_conf_merge_bitmask_value(conf->protocols, prev->protocols,
|
||||||
(NGX_CONF_BITMASK_SET
|
(NGX_CONF_BITMASK_SET|NGX_SSL_DEFAULT_PROTOCOLS));
|
||||||
|NGX_SSL_TLSv1|NGX_SSL_TLSv1_1
|
|
||||||
|NGX_SSL_TLSv1_2|NGX_SSL_TLSv1_3));
|
|
||||||
#else
|
|
||||||
ngx_conf_merge_bitmask_value(conf->protocols, prev->protocols,
|
|
||||||
(NGX_CONF_BITMASK_SET
|
|
||||||
|NGX_SSL_TLSv1_2|NGX_SSL_TLSv1_3));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
ngx_conf_merge_uint_value(conf->verify, prev->verify, 0);
|
ngx_conf_merge_uint_value(conf->verify, prev->verify, 0);
|
||||||
ngx_conf_merge_uint_value(conf->verify_depth, prev->verify_depth, 1);
|
ngx_conf_merge_uint_value(conf->verify_depth, prev->verify_depth, 1);
|
||||||
|
@ -2181,16 +2181,8 @@ ngx_stream_proxy_merge_srv_conf(ngx_conf_t *cf, void *parent, void *child)
|
|||||||
ngx_conf_merge_value(conf->ssl_session_reuse,
|
ngx_conf_merge_value(conf->ssl_session_reuse,
|
||||||
prev->ssl_session_reuse, 1);
|
prev->ssl_session_reuse, 1);
|
||||||
|
|
||||||
#ifndef SSL_OP_NO_TLSv1_2
|
|
||||||
ngx_conf_merge_bitmask_value(conf->ssl_protocols, prev->ssl_protocols,
|
ngx_conf_merge_bitmask_value(conf->ssl_protocols, prev->ssl_protocols,
|
||||||
(NGX_CONF_BITMASK_SET
|
(NGX_CONF_BITMASK_SET|NGX_SSL_DEFAULT_PROTOCOLS));
|
||||||
|NGX_SSL_TLSv1|NGX_SSL_TLSv1_1
|
|
||||||
|NGX_SSL_TLSv1_2|NGX_SSL_TLSv1_3));
|
|
||||||
#else
|
|
||||||
ngx_conf_merge_bitmask_value(conf->ssl_protocols, prev->ssl_protocols,
|
|
||||||
(NGX_CONF_BITMASK_SET
|
|
||||||
|NGX_SSL_TLSv1_2|NGX_SSL_TLSv1_3));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
ngx_conf_merge_str_value(conf->ssl_ciphers, prev->ssl_ciphers, "DEFAULT");
|
ngx_conf_merge_str_value(conf->ssl_ciphers, prev->ssl_ciphers, "DEFAULT");
|
||||||
|
|
||||||
|
@ -882,16 +882,8 @@ ngx_stream_ssl_merge_srv_conf(ngx_conf_t *cf, void *parent, void *child)
|
|||||||
|
|
||||||
ngx_conf_merge_value(conf->reject_handshake, prev->reject_handshake, 0);
|
ngx_conf_merge_value(conf->reject_handshake, prev->reject_handshake, 0);
|
||||||
|
|
||||||
#ifndef SSL_OP_NO_TLSv1_2
|
|
||||||
ngx_conf_merge_bitmask_value(conf->protocols, prev->protocols,
|
ngx_conf_merge_bitmask_value(conf->protocols, prev->protocols,
|
||||||
(NGX_CONF_BITMASK_SET
|
(NGX_CONF_BITMASK_SET|NGX_SSL_DEFAULT_PROTOCOLS));
|
||||||
|NGX_SSL_TLSv1|NGX_SSL_TLSv1_1
|
|
||||||
|NGX_SSL_TLSv1_2|NGX_SSL_TLSv1_3));
|
|
||||||
#else
|
|
||||||
ngx_conf_merge_bitmask_value(conf->protocols, prev->protocols,
|
|
||||||
(NGX_CONF_BITMASK_SET
|
|
||||||
|NGX_SSL_TLSv1_2|NGX_SSL_TLSv1_3));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
ngx_conf_merge_uint_value(conf->verify, prev->verify, 0);
|
ngx_conf_merge_uint_value(conf->verify, prev->verify, 0);
|
||||||
ngx_conf_merge_uint_value(conf->verify_depth, prev->verify_depth, 1);
|
ngx_conf_merge_uint_value(conf->verify_depth, prev->verify_depth, 1);
|
||||||
|
Loading…
Reference in New Issue
Block a user