|
32 | 32 | #include "ngx_stream_lua_ssl_certby.h" |
33 | 33 |
|
34 | 34 | #ifdef HAVE_PROXY_SSL_PATCH |
| 35 | +#include "ngx_stream_lua_proxy_ssl_certby.h" |
35 | 36 | #include "ngx_stream_lua_proxy_ssl_verifyby.h" |
36 | 37 | #endif |
37 | 38 |
|
@@ -428,6 +429,20 @@ static ngx_command_t ngx_stream_lua_cmds[] = { |
428 | 429 |
|
429 | 430 | #ifdef HAVE_PROXY_SSL_PATCH |
430 | 431 | /* same context as proxy_pass directive */ |
| 432 | + { ngx_string("proxy_ssl_certificate_by_lua_block"), |
| 433 | + NGX_STREAM_SRV_CONF|NGX_CONF_BLOCK|NGX_CONF_NOARGS, |
| 434 | + ngx_stream_lua_proxy_ssl_cert_by_lua_block, |
| 435 | + NGX_STREAM_SRV_CONF_OFFSET, |
| 436 | + 0, |
| 437 | + (void *) ngx_stream_lua_proxy_ssl_cert_handler_inline }, |
| 438 | + |
| 439 | + { ngx_string("proxy_ssl_certificate_by_lua_file"), |
| 440 | + NGX_STREAM_SRV_CONF|NGX_CONF_TAKE1, |
| 441 | + ngx_stream_lua_proxy_ssl_cert_by_lua, |
| 442 | + NGX_STREAM_SRV_CONF_OFFSET, |
| 443 | + 0, |
| 444 | + (void *) ngx_stream_lua_proxy_ssl_cert_handler_file }, |
| 445 | + |
431 | 446 | { ngx_string("proxy_ssl_verify_by_lua_block"), |
432 | 447 | NGX_STREAM_SRV_CONF|NGX_CONF_BLOCK|NGX_CONF_NOARGS, |
433 | 448 | ngx_stream_lua_proxy_ssl_verify_by_lua_block, |
@@ -855,6 +870,10 @@ ngx_stream_lua_create_srv_conf(ngx_conf_t *cf) |
855 | 870 | * lscf->srv.ssl_client_hello_src = { 0, NULL }; |
856 | 871 | * lscf->srv.ssl_client_hello_src_key = NULL; |
857 | 872 | * |
| 873 | + * lscf->ups.proxy_ssl_cert_handler = NULL; |
| 874 | + * lscf->ups.proxy_ssl_cert_src = { 0, NULL }; |
| 875 | + * lscf->ups.proxy_ssl_cert_src_key = NULL; |
| 876 | + * |
858 | 877 | * lscf->ups.proxy_ssl_verify_handler = NULL; |
859 | 878 | * lscf->ups.proxy_ssl_verify_src = { 0, NULL }; |
860 | 879 | * lscf->ups.proxy_ssl_verify_src_key = NULL; |
@@ -1038,6 +1057,18 @@ ngx_stream_lua_merge_srv_conf(ngx_conf_t *cf, void *parent, void *child) |
1038 | 1057 | #endif |
1039 | 1058 |
|
1040 | 1059 | #ifdef HAVE_PROXY_SSL_PATCH |
| 1060 | + if (conf->ups.proxy_ssl_cert_src.len == 0) { |
| 1061 | + conf->ups.proxy_ssl_cert_src = prev->ups.proxy_ssl_cert_src; |
| 1062 | + conf->ups.proxy_ssl_cert_handler = prev->ups.proxy_ssl_cert_handler; |
| 1063 | + conf->ups.proxy_ssl_cert_src_key = prev->ups.proxy_ssl_cert_src_key; |
| 1064 | + } |
| 1065 | + |
| 1066 | + if (conf->ups.proxy_ssl_cert_src.len) { |
| 1067 | + if (ngx_stream_lua_proxy_ssl_cert_set_callback(cf) != NGX_OK) { |
| 1068 | + return NGX_CONF_ERROR; |
| 1069 | + } |
| 1070 | + } |
| 1071 | + |
1041 | 1072 | if (conf->ups.proxy_ssl_verify_src.len == 0) { |
1042 | 1073 | conf->ups.proxy_ssl_verify_src = prev->ups.proxy_ssl_verify_src; |
1043 | 1074 | conf->ups.proxy_ssl_verify_handler = prev->ups.proxy_ssl_verify_handler; |
|
0 commit comments