Skip to content
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

About lua_ssl question? #638

Closed
laozi2 opened this issue Jan 4, 2016 · 2 comments
Closed

About lua_ssl question? #638

laozi2 opened this issue Jan 4, 2016 · 2 comments

Comments

@laozi2
Copy link

laozi2 commented Jan 4, 2016

Because lua_ssl_*(such as lua_ssl_ciphers) are configured in the http/server/location context,
but if there is more than one cosockets will request to diffent SSL/TLS servers in one lua script( or nignx http request), such as sock1 is used for http upstream server, sock2 is used for mysql upstream server, but they use diffent SSL/TLS configure.
And the question is, is it a problem or how to sovle it ?

@laozi2 laozi2 changed the title About lua_ssl question About lua_ssl question? Jan 4, 2016
@agentzh
Copy link
Member

agentzh commented Jan 4, 2016

@laozi2 Correct. Right now all the cosockets in a single location share the same lua_ssl_* configurations. To solve this, I think we can implement cosocket object level SSL ctx API, as in

local ngx_ssl_ctx = require "ngx.ssl.ctx"
local ssl_ctx = ngx_ssl_ctx.new{ ciphers = "...", protocols = "..." }

And then just reference the SSL ctx on a particular cosocket object before calling sslhandshake, as in

local ok, err = cosocket:setsslctx(ssl_ctx)
if not ok then
    return error("failed to set ssl ctx: ", err)
end
ok, err = cosocket:sslhandshake(...)

What do you think of it? Are you interested in contributing an implementation for this? You can check how the existing ngx.ssl module is implemented in the following PRs, for example.

#637

openresty/lua-resty-core#12

Thanks!

@laozi2
Copy link
Author

laozi2 commented Jan 5, 2016

Cool, it seems like a good soultion, I would like to think about it, thanks!

@laozi2 laozi2 closed this as completed Jan 5, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants