diff --git a/src/event/ngx_event_openssl.c b/src/event/ngx_event_openssl.c
index 5eab4af..4fb9645 100644
|
a
|
b
|
ngx_ssl_create(ngx_ssl_t *ssl, ngx_uint_t protocols, void *data)
|
| 157 | 157 | SSL_CTX_set_options(ssl->ctx, SSL_OP_NETSCAPE_CHALLENGE_BUG); |
| 158 | 158 | SSL_CTX_set_options(ssl->ctx, SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG); |
| 159 | 159 | |
| | 160 | /* verification options */ |
| | 161 | |
| | 162 | SSL_CTX_load_verify_locations(ssl->ctx, (const char *)ssl->ca_certificate.data, NULL); |
| | 163 | SSL_CTX_set_verify(ssl->ctx, ssl->verify, NULL); |
| | 164 | SSL_CTX_set_verify_depth(ssl->ctx, ssl->verify_depth); |
| | 165 | |
| 160 | 166 | /* server side options */ |
| 161 | 167 | |
| 162 | 168 | SSL_CTX_set_options(ssl->ctx, SSL_OP_SSLREF2_REUSE_CERT_TYPE_BUG); |
diff --git a/src/event/ngx_event_openssl.h b/src/event/ngx_event_openssl.h
index a8f9d87..264f748 100644
|
a
|
b
|
|
| 27 | 27 | typedef struct { |
| 28 | 28 | SSL_CTX *ctx; |
| 29 | 29 | ngx_log_t *log; |
| | 30 | ngx_uint_t verify; |
| | 31 | ngx_uint_t verify_depth; |
| | 32 | ngx_str_t ca_certificate; |
| 30 | 33 | } ngx_ssl_t; |
| 31 | 34 | |
| 32 | 35 | |
diff --git a/src/http/modules/ngx_http_proxy_module.c b/src/http/modules/ngx_http_proxy_module.c
index 518bf85..232cbb0 100644
|
a
|
b
|
static ngx_command_t ngx_http_proxy_commands[] = {
|
| 466 | 466 | offsetof(ngx_http_proxy_loc_conf_t, upstream.ssl_session_reuse), |
| 467 | 467 | NULL }, |
| 468 | 468 | |
| | 469 | { ngx_string("proxy_ssl_verify"), |
| | 470 | NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, |
| | 471 | ngx_conf_set_num_slot, |
| | 472 | NGX_HTTP_LOC_CONF_OFFSET, |
| | 473 | offsetof(ngx_http_proxy_loc_conf_t, upstream.ssl_verify), |
| | 474 | NULL }, |
| | 475 | |
| | 476 | { ngx_string("proxy_ssl_verify_depth"), |
| | 477 | NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, |
| | 478 | ngx_conf_set_num_slot, |
| | 479 | NGX_HTTP_LOC_CONF_OFFSET, |
| | 480 | offsetof(ngx_http_proxy_loc_conf_t, upstream.ssl_verify_depth), |
| | 481 | NULL }, |
| | 482 | |
| | 483 | { ngx_string("proxy_ssl_ca_certificate"), |
| | 484 | NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, |
| | 485 | ngx_conf_set_str_slot, |
| | 486 | NGX_HTTP_LOC_CONF_OFFSET, |
| | 487 | offsetof(ngx_http_proxy_loc_conf_t, upstream.ssl_ca_certificate), |
| | 488 | NULL }, |
| | 489 | |
| 469 | 490 | #endif |
| 470 | 491 | |
| 471 | 492 | ngx_null_command |
| … |
… |
ngx_http_proxy_create_loc_conf(ngx_conf_t *cf)
|
| 1950 | 1971 | conf->upstream.intercept_errors = NGX_CONF_UNSET; |
| 1951 | 1972 | #if (NGX_HTTP_SSL) |
| 1952 | 1973 | conf->upstream.ssl_session_reuse = NGX_CONF_UNSET; |
| | 1974 | conf->upstream.ssl_verify = NGX_CONF_UNSET_UINT; |
| | 1975 | conf->upstream.ssl_verify_depth = NGX_CONF_UNSET_UINT; |
| 1953 | 1976 | #endif |
| 1954 | 1977 | |
| 1955 | 1978 | /* "proxy_cyclic_temp_file" is disabled */ |
| … |
… |
ngx_http_proxy_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
|
| 2196 | 2219 | #if (NGX_HTTP_SSL) |
| 2197 | 2220 | ngx_conf_merge_value(conf->upstream.ssl_session_reuse, |
| 2198 | 2221 | prev->upstream.ssl_session_reuse, 1); |
| | 2222 | ngx_conf_merge_uint_value(conf->upstream.ssl_verify, |
| | 2223 | prev->upstream.ssl_verify, 0); |
| | 2224 | ngx_conf_merge_uint_value(conf->upstream.ssl_verify_depth, |
| | 2225 | prev->upstream.ssl_verify_depth, 1); |
| | 2226 | ngx_conf_merge_str_value(conf->upstream.ssl_ca_certificate, |
| | 2227 | prev->upstream.ssl_ca_certificate, ""); |
| | 2228 | |
| | 2229 | if (conf->upstream.ssl_verify) { |
| | 2230 | if (conf->upstream.ssl_ca_certificate.len == 0) { |
| | 2231 | ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
| | 2232 | "no \"proxy_ssl_ca_certificate\" is defined for " |
| | 2233 | "the \"proxy_ssl_verify\" directive"); |
| | 2234 | |
| | 2235 | return NGX_CONF_ERROR; |
| | 2236 | } |
| | 2237 | } |
| 2199 | 2238 | #endif |
| 2200 | 2239 | |
| 2201 | 2240 | ngx_conf_merge_value(conf->redirect, prev->redirect, 1); |
| … |
… |
ngx_http_proxy_set_ssl(ngx_conf_t *cf, ngx_http_proxy_loc_conf_t *plcf)
|
| 3011 | 3050 | |
| 3012 | 3051 | plcf->upstream.ssl->log = cf->log; |
| 3013 | 3052 | |
| | 3053 | plcf->upstream.ssl->ca_certificate.len = plcf->upstream.ssl_ca_certificate.len; |
| | 3054 | plcf->upstream.ssl->ca_certificate.data = plcf->upstream.ssl_ca_certificate.data; |
| | 3055 | |
| | 3056 | plcf->upstream.ssl->verify = plcf->upstream.ssl_verify; |
| | 3057 | plcf->upstream.ssl->verify_depth = plcf->upstream.ssl_verify_depth; |
| | 3058 | |
| 3014 | 3059 | if (ngx_ssl_create(plcf->upstream.ssl, |
| 3015 | 3060 | NGX_SSL_SSLv2|NGX_SSL_SSLv3|NGX_SSL_TLSv1, NULL) |
| 3016 | 3061 | != NGX_OK) |
diff --git a/src/http/ngx_http_upstream.h b/src/http/ngx_http_upstream.h
index 38bd7df..772bbf5 100644
|
a
|
b
|
typedef struct {
|
| 173 | 173 | #if (NGX_HTTP_SSL) |
| 174 | 174 | ngx_ssl_t *ssl; |
| 175 | 175 | ngx_flag_t ssl_session_reuse; |
| | 176 | ngx_uint_t ssl_verify; |
| | 177 | ngx_uint_t ssl_verify_depth; |
| | 178 | ngx_str_t ssl_ca_certificate; |
| 176 | 179 | #endif |
| 177 | 180 | |
| 178 | 181 | } ngx_http_upstream_conf_t; |