feature: support custom trusted CA store for cosocket TLS handshake.#2495
Merged
zhuizhuhaomeng merged 3 commits intoopenresty:masterfrom May 2, 2026
Merged
Conversation
zhuizhuhaomeng
requested changes
Apr 29, 2026
| * [[#tcpsock:bind|bind]] | ||
| * [[#tcpsock:connect|connect]] | ||
| * [[#tcpsock:setclientcert|setclientcert]] | ||
| * [[#tcpsock:settrustedstore|settrustedstore]] |
Contributor
There was a problem hiding this comment.
We should update the README.markdown rather than the wiki
Contributor
Author
There was a problem hiding this comment.
Thanks! I moved the doc to the README.markdown now.
Adds the cosocket-level plumbing for a new tcpsock:settrustedstore(store) method, allowing Lua code to supply a per-handshake X509_STORE that overrides lua_ssl_trusted_certificate for the upcoming sslhandshake(). This is needed for use cases where the set of trusted CAs is determined at request time (e.g. per-tenant mTLS upstreams). * a new X509_STORE *ssl_trusted_store field on ngx_http_lua_socket_tcp_upstream_t, used as a one-shot slot consumed by the handshake; * the FFI entry point ngx_http_lua_ffi_socket_tcp_settrustedstore() that validates the cosocket state and stores the pointer on the upstream; * SSL_set1_verify_cert_store() invocation inside ngx_http_lua_ffi_socket_tcp_sslhandshake() when a store has been set, with the slot cleared after use so it cannot leak across handshakes. The matching tcpsock:settrustedstore() Lua wrapper will land in lua-resty-core in a separate change. Signed-off-by: Walker Zhao <walker.zhao@konghq.com>
5bac2d8 to
0110e9f
Compare
zhuizhuhaomeng
approved these changes
May 2, 2026
Contributor
|
@findns94 I have fixed some issues and merge this PR. |
Contributor
Author
Thanks! I will prepare a PR for stream-lua-nginx-module in a few days. |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Adds the cosocket-level plumbing for a new tcpsock:settrustedstore(store) method, allowing Lua code to supply a per-handshake X509_STORE that overrides lua_ssl_trusted_certificate for the upcoming sslhandshake(). This is needed for use cases where the set of trusted CAs is determined at request time (e.g. per-tenant mTLS upstreams).
The matching tcpsock:settrustedstore() Lua wrapper will land in lua-resty-core in a separate change.
Related
lua-resty-corePR: openresty/lua-resty-core#525I hereby granted the copyright of the changes in this pull request
to the authors of this lua-nginx-module project.