-
Notifications
You must be signed in to change notification settings - Fork 2.1k
feature: proxy_ssl_verify_by_lua directives #2436
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
willmafh
wants to merge
16
commits into
openresty:master
Choose a base branch
from
willmafh:proxy_ssl_verify_by_lua
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 14 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
89923f2
feature: proxy_ssl_verify_by_lua* directives
willmafh 58dda9a
proxy_ssl_verify_by_lua ffi functions build fix
willmafh 0292dcd
feature: lua_upstream_skip_openssl_default_verify directive
willmafh 56db2d1
Merge branch 'master' into proxy_ssl_verify_by_lua
willmafh fe7bf4c
optimize: better way to get server certificate of upstream SSL connec…
willmafh e655d53
adjust where to process upstream skip openssl default verify
willmafh eef8207
chore: code style
willmafh c774bd0
tests: update t/169-proxy-ssl-verify.t for client to successfully ver…
willmafh 3923d54
chore: test case code style
willmafh 744bebf
better way to get proxy ssl context
willmafh e23517e
changes so that we can use ngx.ctx to pass data from downstream
willmafh 1a5c4f5
delete unnecessary proxy ssl verify context macro
willmafh 1de837f
refactor: using real request and connection to implement
willmafh a7d8ed1
fixed build
zhuizhuhaomeng bfdc5a3
chore: code cleanup
willmafh c4888f8
macro to conditional build proxy ssl verify
willmafh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,6 +31,7 @@ | |
#include "ngx_http_lua_ssl_certby.h" | ||
#include "ngx_http_lua_ssl_session_storeby.h" | ||
#include "ngx_http_lua_ssl_session_fetchby.h" | ||
#include "ngx_http_lua_proxy_ssl_verifyby.h" | ||
#include "ngx_http_lua_headers.h" | ||
#include "ngx_http_lua_headers_out.h" | ||
#if !(NGX_WIN32) | ||
|
@@ -660,6 +661,28 @@ static ngx_command_t ngx_http_lua_cmds[] = { | |
0, | ||
(void *) ngx_http_lua_ssl_sess_fetch_handler_file }, | ||
|
||
/* same context as proxy_pass directive */ | ||
{ ngx_string("proxy_ssl_verify_by_lua_block"), | ||
NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF|NGX_CONF_BLOCK|NGX_CONF_NOARGS, | ||
ngx_http_lua_proxy_ssl_verify_by_lua_block, | ||
NGX_HTTP_LOC_CONF_OFFSET, | ||
0, | ||
(void *) ngx_http_lua_proxy_ssl_verify_handler_inline }, | ||
|
||
{ ngx_string("proxy_ssl_verify_by_lua_file"), | ||
NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF|NGX_CONF_TAKE1, | ||
ngx_http_lua_proxy_ssl_verify_by_lua, | ||
NGX_HTTP_LOC_CONF_OFFSET, | ||
0, | ||
(void *) ngx_http_lua_proxy_ssl_verify_handler_file }, | ||
|
||
{ ngx_string("lua_upstream_skip_openssl_default_verify"), | ||
NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF|NGX_CONF_FLAG, | ||
ngx_conf_set_flag_slot, | ||
NGX_HTTP_LOC_CONF_OFFSET, | ||
offsetof(ngx_http_lua_loc_conf_t, upstream_skip_openssl_default_verify), | ||
NULL }, | ||
|
||
{ ngx_string("lua_ssl_verify_depth"), | ||
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, | ||
ngx_conf_set_num_slot, | ||
|
@@ -1446,6 +1469,11 @@ ngx_http_lua_create_loc_conf(ngx_conf_t *cf) | |
* conf->ssl_trusted_certificate = { 0, NULL }; | ||
* conf->ssl_crl = { 0, NULL }; | ||
* conf->ssl_key_log = { 0, NULL }; | ||
* | ||
* conf->proxy_ssl_verify_handler = NULL; | ||
* conf->proxy_ssl_verify_src = { 0, NULL }; | ||
* conf->proxy_ssl_verify_chunkname = NULL; | ||
* conf->proxy_ssl_verify_src_key = NULL; | ||
*/ | ||
|
||
conf->force_read_body = NGX_CONF_UNSET; | ||
|
@@ -1479,6 +1507,8 @@ ngx_http_lua_create_loc_conf(ngx_conf_t *cf) | |
#if (nginx_version >= 1019004) | ||
conf->ssl_conf_commands = NGX_CONF_UNSET_PTR; | ||
#endif | ||
conf->proxy_ssl_verify_src_ref = LUA_REFNIL; | ||
conf->upstream_skip_openssl_default_verify = NGX_CONF_UNSET; | ||
#endif | ||
|
||
return conf; | ||
|
@@ -1573,6 +1603,23 @@ ngx_http_lua_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child) | |
NULL); | ||
#endif | ||
|
||
if (conf->proxy_ssl_verify_src.len == 0) { | ||
conf->proxy_ssl_verify_src = prev->proxy_ssl_verify_src; | ||
conf->proxy_ssl_verify_handler = prev->proxy_ssl_verify_handler; | ||
conf->proxy_ssl_verify_src_ref = prev->proxy_ssl_verify_src_ref; | ||
conf->proxy_ssl_verify_src_key = prev->proxy_ssl_verify_src_key; | ||
conf->proxy_ssl_verify_chunkname = prev->proxy_ssl_verify_chunkname; | ||
} | ||
|
||
if (conf->proxy_ssl_verify_src.len) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should add a macro in th patch to test if the patch has been applied. |
||
if (ngx_http_lua_proxy_ssl_verify_set_callback(cf) != NGX_OK) { | ||
return NGX_CONF_ERROR; | ||
} | ||
} | ||
|
||
ngx_conf_merge_value(conf->upstream_skip_openssl_default_verify, | ||
prev->upstream_skip_openssl_default_verify, 0); | ||
|
||
if (ngx_http_lua_set_ssl(cf, conf) != NGX_OK) { | ||
return NGX_CONF_ERROR; | ||
} | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is v0.5.0rc32?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copied from other places in this
README.markdown
, please search it!