-
Notifications
You must be signed in to change notification settings - Fork 134
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
Add SSL Support - completion of PR#5 #36
base: master
Are you sure you want to change the base?
Conversation
Ssl support
avoid permission requirement by using port > 1024
ping |
@agentzh Can you review? |
lib/resty/upstream/healthcheck.lua
Outdated
end | ||
|
||
if ctx.type == "https" then | ||
session, err = sock:sslhandshake(ctx.session, name, ctx.ssl_verify) |
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.
Is session
a global Lua variable? We should declare it as a local
.
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.
Better use the lua-releng
script of nginx-devel-utils
to check your Lua code. I'm getting the following errors by running this tool against your branch:
$ lua-releng
lib/resty/upstream/healthcheck.lua: 0.03 (0.03)
Checking use of Lua global variables in file lib/resty/upstream/healthcheck.lua...
op no. line instruction args ; code
53 [237] SETGLOBAL 11 -14 ; session
54 [238] GETGLOBAL 11 -14 ; session
73 [244] GETGLOBAL 11 -14 ; session
Checking line length exceeding 80...
So apparently the session
is a misused Lua global variable.
t/sanity.t
Outdated
} | ||
|
||
lua_shared_dict healthcheck 1m; | ||
init_worker_by_lua ' |
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.
We should use init_worker_by_lua_block
here for newly added tests.
t/sanity.t
Outdated
--- config | ||
location = /t { | ||
access_log off; | ||
content_by_lua ' |
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.
We should use content_by_lua_block
in newly added tests. Please fix other similar places.
Also, please rebase to the latest git master. |
@ElvinEfendi Thank you for your patch! Please take care of my comments above. Thanks! |
Comply with lua releng requirements
@agentzh thanks for reviewing, I addressed your comments.
I don't see any conflict with the upstream master(there were some initially but those have been sycned to this branch already). And all the commits from it are already included in this branch. Why do you think this branch is not in sync with the upstream master? |
@agentzh any more comment on this PR? |
By default |
let users to pass custom server_name to tcpsock:sslhandshake function
add status_table API
why this pr has not bean merged? |
@solio This is still in my review queue. Sorry for the delay on my side. |
@ElvinEfendi Will you please rebase to the latest git master? I'm seeing merge conflicts while rebasing it myself:
Thanks! And sorry for the delay on my side. |
Hmm I don't know why does it show conflict. There's no commit in the upstream after 69751de which is already in downstream as well Shopify@69751de. master...Shopify:master also shows "Able to merge": |
@ElvinEfendi Cool, thanks! |
hmmm, may I ping on this PR? :) |
@agentzh when do u plan to merge it? Thx |
Sorry, we haven't had the time to look at this. Been busy with other things with higher priority. |
@dndx @spacewander Please help review this PR once you have a chance. Thanks! |
Hi, |
Dears, any update on this feature? |
+1 year :-/ |
@rainingmaster do you have time to take a look at this PR? |
@agentzh is there any plan to merge this ? |
Hi @ElvinEfendi did you publish a rock with these changes? If you didn't, I'm thinking to keep a |
I copied this PR and released it as a rock https://github.com/globocom/lua-resty-upstream-healthcheck |
type = "http", | ||
|
||
-- type = "https", |
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.
we do not add such a comment in the sample code, here just keep the options related to https, detailed explanation is placed below
if typ ~= "http" then | ||
return nil, "only \"http\" type is supported right now" | ||
if typ ~= "http" and typ ~= "https" then | ||
return nil, "no support for this protocol type" |
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.
It is better to point out in the error message what the unsupported type is
|
||
server { | ||
listen 12355; | ||
ssl on; |
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.
the "ssl" directive is deprecated, use the "listen ... ssl" directive instead
|
||
server { | ||
listen 12355; | ||
ssl on; |
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.
Ditto
|
||
server { | ||
listen 12355; | ||
ssl on; |
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.
Ditto
|
||
server { | ||
listen 12355; | ||
ssl on; |
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.
Ditto
|
||
server { | ||
listen 12355; | ||
ssl on; |
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.
Ditto
|
||
server { | ||
listen 12355; | ||
ssl on; |
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.
Ditto
|
||
server { | ||
listen 12355; | ||
ssl on; |
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.
Ditto
|
||
server { | ||
listen 12355; | ||
ssl on; |
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.
Ditto
This PR is based on the work done at #5.
It adds SSL support and addresses all the comments(tests and session reuse) made in the original PR.
One significant modification to the original PR is that now, the health check will fail if
ssl_verify = true
and the certificate verification fails./r @agentzh