|
30 | 30 | #include "ngx_stream_lua_semaphore.h" |
31 | 31 | #include "ngx_stream_lua_ssl_client_helloby.h" |
32 | 32 | #include "ngx_stream_lua_ssl_certby.h" |
| 33 | + |
| 34 | +#ifdef HAVE_PROXY_SSL_PATCH |
| 35 | +#include "ngx_stream_lua_proxy_ssl_certby.h" |
33 | 36 | #include "ngx_stream_lua_proxy_ssl_verifyby.h" |
| 37 | +#endif |
34 | 38 |
|
35 | 39 | #include "ngx_stream_lua_prereadby.h" |
36 | 40 |
|
@@ -429,8 +433,22 @@ static ngx_command_t ngx_stream_lua_cmds[] = { |
429 | 433 | 0, |
430 | 434 | (void *) ngx_stream_lua_ssl_cert_handler_file }, |
431 | 435 |
|
432 | | -#if HAVE_LUA_PROXY_SSL_VERIFY |
| 436 | +#if HAVE_PROXY_SSL_PATCH |
433 | 437 | /* same context as proxy_pass directive */ |
| 438 | + { ngx_string("proxy_ssl_certificate_by_lua_block"), |
| 439 | + NGX_STREAM_SRV_CONF|NGX_CONF_BLOCK|NGX_CONF_NOARGS, |
| 440 | + ngx_stream_lua_proxy_ssl_cert_by_lua_block, |
| 441 | + NGX_STREAM_SRV_CONF_OFFSET, |
| 442 | + 0, |
| 443 | + (void *) ngx_stream_lua_proxy_ssl_cert_handler_inline }, |
| 444 | + |
| 445 | + { ngx_string("proxy_ssl_certificate_by_lua_file"), |
| 446 | + NGX_STREAM_SRV_CONF|NGX_CONF_TAKE1, |
| 447 | + ngx_stream_lua_proxy_ssl_cert_by_lua, |
| 448 | + NGX_STREAM_SRV_CONF_OFFSET, |
| 449 | + 0, |
| 450 | + (void *) ngx_stream_lua_proxy_ssl_cert_handler_file }, |
| 451 | + |
434 | 452 | { ngx_string("proxy_ssl_verify_by_lua_block"), |
435 | 453 | NGX_STREAM_SRV_CONF|NGX_CONF_BLOCK|NGX_CONF_NOARGS, |
436 | 454 | ngx_stream_lua_proxy_ssl_verify_by_lua_block, |
@@ -858,6 +876,10 @@ ngx_stream_lua_create_srv_conf(ngx_conf_t *cf) |
858 | 876 | * lscf->srv.ssl_client_hello_src = { 0, NULL }; |
859 | 877 | * lscf->srv.ssl_client_hello_src_key = NULL; |
860 | 878 | * |
| 879 | + * lscf->ups.proxy_ssl_cert_handler = NULL; |
| 880 | + * lscf->ups.proxy_ssl_cert_src = { 0, NULL }; |
| 881 | + * lscf->ups.proxy_ssl_cert_src_key = NULL; |
| 882 | + * |
861 | 883 | * lscf->ups.proxy_ssl_verify_handler = NULL; |
862 | 884 | * lscf->ups.proxy_ssl_verify_src = { 0, NULL }; |
863 | 885 | * lscf->ups.proxy_ssl_verify_src_key = NULL; |
@@ -1039,7 +1061,19 @@ ngx_stream_lua_merge_srv_conf(ngx_conf_t *cf, void *parent, void *child) |
1039 | 1061 | NULL); |
1040 | 1062 | #endif |
1041 | 1063 |
|
1042 | | -#if HAVE_LUA_PROXY_SSL_VERIFY |
| 1064 | +#ifdef HAVE_PROXY_SSL_PATCH |
| 1065 | + if (conf->ups.proxy_ssl_cert_src.len == 0) { |
| 1066 | + conf->ups.proxy_ssl_cert_src = prev->ups.proxy_ssl_cert_src; |
| 1067 | + conf->ups.proxy_ssl_cert_handler = prev->ups.proxy_ssl_cert_handler; |
| 1068 | + conf->ups.proxy_ssl_cert_src_key = prev->ups.proxy_ssl_cert_src_key; |
| 1069 | + } |
| 1070 | + |
| 1071 | + if (conf->ups.proxy_ssl_cert_src.len) { |
| 1072 | + if (ngx_stream_lua_proxy_ssl_cert_set_callback(cf) != NGX_OK) { |
| 1073 | + return NGX_CONF_ERROR; |
| 1074 | + } |
| 1075 | + } |
| 1076 | + |
1043 | 1077 | if (conf->ups.proxy_ssl_verify_src.len == 0) { |
1044 | 1078 | conf->ups.proxy_ssl_verify_src = prev->ups.proxy_ssl_verify_src; |
1045 | 1079 | conf->ups.proxy_ssl_verify_handler = prev->ups.proxy_ssl_verify_handler; |
|
0 commit comments