-
Notifications
You must be signed in to change notification settings - Fork 2k
Control Nginx SSL/SNI with Lua #331
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
Comments
@miracle2k No. This requires patching nginx I guess :) |
I was hoping that nginx might have a plugin hook that lua-nginx could expose. Of course, if this isn't a thing that realistically is going to happen, we can close the ticket. |
I'd really have liked this to be possible without patching nginx. @agentzh could you elaborate a bit? There are alternative "ways" of doing similar things outside of nginx e.g: https://github.com/dlundquist/sniproxy |
@bearnard Yeah, it's good to have. Maybe we could ask the Nginx team to add a hook for us :) |
Hi I will start a thread on nginx mailing list to hopefully get an nginx hook added.. It will just highlight the problem, hopefully you guys can add your support and suggestions in response to it.. Thanks |
@rkearsley yeah we need more voices from the community. I actually talked about it with some guys on the nginx team in person a few weeks ago. But to change their priority, we really need more voices. |
I need this feature as well. It would be nice to just drop the certificate and key files into a specified directory and have lua just start using them without using scripts to rebuild the config and restart nginx, which is what I'm currently doing. |
@Shananra I'll try to patch the nginx core to have the hooks required by ngx_lua (and other nginx C modules) :) |
I do have plans to add hooks to the nginx core and implement directives like |
@agentzh Awesome. Thanks a ton for doing that. |
The directive names are going to be |
\o/ |
@agentzh let me know if I can help out with testing etc... |
@bearnard Sure, I'll let you know. |
@agentzh We're very excited by the possibility of this too. I'd definitely be interested in helping out or testing in any way I can. |
@chrisboulton Thanks! I'll post things here when I'm ready. |
Would it be possible to integrate a keyless oracle too? as in http://arstechnica.com/information-technology/2014/09/in-depth-how-cloudflares-new-web-service-promises-security-without-the-key/ |
@jperla That's another story and requires a patched version of OpenSSL. Whether CloudFlare is going to opensource the keyless stuff is not determined yet AFAIK. |
+1 |
FYI, the feature that adds the |
@agentzh Still on track for March? We're very keen to start digging in and utilizing |
@chrisboulton Yes, sure. I'm trying to opensource it on 1 March. |
+1 |
@agentzh any updates ? |
@andrea-spoldi It's taking longer than I wanted. Still working on it. |
Okay, I'm very sorry that I don't have enough time to polish up our internal branch for https://github.com/openresty/lua-nginx-module/tree/ssl-cert-by-lua And there's no documentation but we have comprehensive test cases for Check the test cases for various usage. They're declarative and precise :) A lot of existing Lua APIs are available in this new context, including BTW, this To make it work, you need to
Let me know if you have any further problems. There's still a lot of work before this branch can be merged into master and become part of a release. Anyway, hopefully you'll find this useful and helpful. Feedback welcome! |
:+1 |
Much appreciated |
@agentzh thanks for it. this is what I got |
@andrea-spoldi Make sure you're compiling nginx with |
编译ssl-cert-by-lua分支下的lua-module报错 objs/ngx_modules.o openssl 已经安装OpenSSL 1.0.1 14 Mar 2012 |
@syzh Please, no Chinese here. This place is considered English only. Regarding your problem, you need at least OpenSSL 1.0.2, as specified in my previous comment above. BTW, please do not cross-post. Thanks for your cooperation. |
Just a quick update: I've just enabled the coroutine.* and ngx.thread.* API in the context of ssl_certificiate_by_lua* in the I'm currently working on the
The Lua API in the I'll also clean up the nginx core patches and propose them to the nginx-devel mailing. Hopefully we will no longer to patch the nginx core for this feature soon. |
Okay, this feature has just been merged into master. It will get included in the next OpenResty formal release (1.9.7.2). I'm closing this. |
Bravo! Thanks for all of the hard work you've put into this @agentzh! 👏 |
thanks 👍 |
I couldn't ask for a better start to the year, thanks @agentzh 👌 |
Thank you so much for this @agentzh |
Sorry, running a bit late :) I got tied up trying to get an openssl 1.0.2e package built for Precise. So far so good here on testing on Precise with nginx 1.9.9. Out of curiosity, why is openssl 1.0.2e required over 1.0.2a? |
Oh, and a huge thanks! :) |
@moseleymark Just because I didn't want to bother testing compatibility with earlier versions of OpenSSL 1.0.2. |
@moseleymark IMHO 1.0.2a should work just fine. It's always recommended to use the latest version when using from https://openssl.org/.
Take a look at https://github.com/jgautheron/dockerfiles/blob/master/openresty/Dockerfile for an example. |
FYI, this ssl_certificate_by_lua* feature has been included in the OpenResty 1.9.7.2 RC1 version: https://groups.google.com/d/msg/openresty-en/SZsbhGJc6D0/vJ0eHSIbCwAJ The ssl_session_fetch/store_by_lua* feature will be opensourced soon. And we'll announce on the openresty-en mailing list when it's out :) Stay tuned. |
Thanks once more @agentzh |
the test file of ssl-cert-by has changed to page https://github.com/openresty/lua-nginx-module/blob/ssl-cert-by-lua/t/139-ssl-cert-by.t @agentzh Could you change the page link in #331 (comment) |
@favorinfo The |
A question regarding this feature: In #331 (comment) @agentzh writes
Is this still applicable? or has the patch been upstreamed to nginx core? |
@jarl-dk Pleas read the manual: https://github.com/openresty/lua-nginx-module#ssl_certificate_by_lua_block The info there is always up to date and it already answers your question. BTW, this ticket is already closed and obsolete. |
FYI, we've just opensourced the
The rendered documentation for these new features can be browsed here: |
Hello, I have a problem when using Kong dynamic SSL: curl -X POST http://localhost:8001/apis/cdnaas_stage1/plugins --form "name=ssl" --form "config.cert=@/home/trevor/frontdoor/kong/server.crt" --form "config.key=@/home/trevor/frontdoor/kong/server.key"and the configuration seems to be successful, but when I access it from: the certificate returned to me is still the certificate from Kong, not my own certificate: [root@localhost kong]# curl -i -v -k -X GET https://localhost:8443/healthcheck --header "Host:cdnaas.stage1.foo.com"
Could you tell me what's the problem? my Email address: [email protected] |
@trevortao this is a Kong issue - I would open an issue at https://github.com/Mashape/kong/issues |
Just curious if there's a roadmap for extending the dynamic SSL certificate stuff to streaming (i.e. the ngx_stream_* stuff) too. Not being impatient :) Just trying to get a feel, since there was a project I was thinking of doing that would use that. Thanks! |
@moseleymark Yes, we'll get there eventually in ngx_stream_lua_module. |
Is ngx.ssl supports setting ssl_client_certificate? |
@WangBaoling No, it does not support client certificates yet. |
@WangBaoling Patches welcome :) |
Hi I have some problem on this. I would like to run ssl on my docker container but it always glitch on port 80 and 443. |
I'd like to run some LUA to support multiple frontends with different SSL certificates, ideally via SNI. I will need to execute my Lua code before the SSL is decoded (and make it use the correct certificate).
I gather this is not supported?
The text was updated successfully, but these errors were encountered: