Comments (10)
@lziest @ghedo Is it possible? ;)
My hunch is that it might be too late in this phase.
from lua-resty-core.
We have a similar requirement where some clients require stricter ssl. So we're also needing the ability to set ciphers (and the protocols, eg. tls 1.1, 1.2) dynamically on a per request basis.
from lua-resty-core.
@rayward You are welcome to do experiments and contribute patches :)
from lua-resty-core.
Sorry I'm a bit late :)
Yes, it is possible to set cipher suites inside the certificates callback, but you need some support from C. I made openresty/lua-nginx-module#961 which adds a new FFI function to set SSL ciphers.
Once that's merged it should be trivial to add a Lua function to the ngx.ssl
module.
from lua-resty-core.
On the other hand it is not possible to enable/disable protocol versions, since the callback is run too late. And it's certainly not possible to set ciphers or protocols on a per-request basis (you can only do it during the initial connection handshake).
from lua-resty-core.
@ghedo thanks for jumping on this! per-connection rather than per-request works for us.
I wonder if it would be possible to support dynamic protocols with a change to the nginx/openresty core such that the IP (and SNI header?) of an incoming connection could be provided to a callback before the handshake is completed.
from lua-resty-core.
Well, if all you need is the client or target server IP to make a decision then yes, you can do that after the TCP connection is established but before the TLS handshake starts, but you would need to modify the nginx code to do that (and I don't think the nginx and openresty developers would be much in favour of merging such changes).
As far as SNI goes, OpenSSL does provide a callback like you describe, but that too is called too late, after a version has already been picked by the server. To support what you need would also require patches to OpenSSL in order to add an additional callback there.
Maybe worth noting is that BoringSSL does provide a callback that can be used to set available protocols, howver it would need integration into ngx_lua (which doesn't support BoringSSL at all at the moment). But note that using BoringSSL in a production system is somewhat discouraged, due to the fast changing (and fast breaking) nature of the project.
from lua-resty-core.
Thanks for the insight, yeh I can understand that such a change would likely not go in. We'll have to stick with dynamically building nginx server blocks to meet our needs.
from lua-resty-core.
@agentzh @ghedo now is 2023 đľâđŤđľâđŤđľâđŤ
from lua-resty-core.
Openresty has been supporting set_protocols in the ssl_client_hello phase https://github.com/openresty/lua-resty-core/blob/master/lib/ngx/ssl/clienthello.md#set_protocols, So if you want to dynamically set ciphers, You actually can use the similar way to do this. @SaromChars
from lua-resty-core.
Related Issues (20)
- Error : failed to run balancer_by_lua*: /usr/local/lib/lua/resty/core/base.lua:24: ngx_http_lua_module 0.10.19 or 0.10.20 required HOT 2
- can ngx.resty.core support proxy ceritificate setting directives
- ngx.var.ssl_ciphers in ssl_certificate_by_lua HOT 1
- Failed on IBM Z/S390x HOT 1
- how to set error log level ? HOT 4
- 2022/06/14 05:43:28 [error] 159#0: *45 lua entry thread aborted: runtime error: /opt/nginx/lib/lua/resty/core/misc.lua:178: /usr/local/lib/libluajit-5.1.so.2: undefined symbol: ngx_http_lua_ffi_req_is_internal stack traceback: coroutine 0: [C]: in function '__index' /opt/nginx/lib/lua/resty/core/misc.lua:178: in function 'is_internal' /opt/nginx/scripts/manage_access_session.lua:70: in main chunk, client: 10.221.16.1 HOT 11
- no ssl session caching happen, always new session ID!
- 0.1.24 tag missing features from lua-nginx-module 0.10.22
- I want to get all the extension information of client hello, not just server name , what can I do? HOT 6
- b64.encode_base64url problem HOT 3
- undocumented that errlog.set_filter_level can not be set lower than error_log level HOT 1
- ngx.sleep() does not work in ssl_client_hello_by_lua* HOT 13
- undefined symbol: ngx_http_lua_ffi_var_get HOT 3
- ngx.balancer ĺŚä˝čŽžç˝ŽéčŻçśćç HOT 3
- why the lua version number is commented out in Makefile HOT 4
- nginx: [alert] failed to load the 'resty.core' module (https://github.com/openresty/lua-resty-core); ensure you are using an OpenResty release from https://openresty.org/en/download.html (reason: module 'resty.core' not found: HOT 5
- ngx.shared.DICT:ttl() returns 0 for the exipred key
- Requesting information about security fixes. HOT 1
- runtime error: /usr/local/openresty/lualib/ngx/semaphore.lua:129: attempt to perform arithmetic on a nil value HOT 1
- get_client_hello_ext() | lua-resty-core/lib/ngx/ssl | Issue with custom TLS Extension Type 17516
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
đ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. đđđ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google â¤ď¸ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lua-resty-core.