Commit 5bac2d8
committed
feature: support custom trusted CA store for cosocket TLS handshake.
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>1 parent cf9f7aa commit 5bac2d8
4 files changed
Lines changed: 425 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6662 | 6662 | | |
6663 | 6663 | | |
6664 | 6664 | | |
| 6665 | + | |
6665 | 6666 | | |
6666 | 6667 | | |
6667 | 6668 | | |
| |||
6866 | 6867 | | |
6867 | 6868 | | |
6868 | 6869 | | |
| 6870 | + | |
| 6871 | + | |
| 6872 | + | |
| 6873 | + | |
| 6874 | + | |
| 6875 | + | |
| 6876 | + | |
| 6877 | + | |
| 6878 | + | |
| 6879 | + | |
| 6880 | + | |
| 6881 | + | |
| 6882 | + | |
| 6883 | + | |
| 6884 | + | |
| 6885 | + | |
| 6886 | + | |
| 6887 | + | |
| 6888 | + | |
| 6889 | + | |
| 6890 | + | |
| 6891 | + | |
| 6892 | + | |
| 6893 | + | |
| 6894 | + | |
| 6895 | + | |
| 6896 | + | |
| 6897 | + | |
6869 | 6898 | | |
6870 | 6899 | | |
6871 | 6900 | | |
| |||
6894 | 6923 | | |
6895 | 6924 | | |
6896 | 6925 | | |
6897 | | - | |
| 6926 | + | |
| 6927 | + | |
| 6928 | + | |
| 6929 | + | |
6898 | 6930 | | |
6899 | 6931 | | |
6900 | 6932 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1939 | 1939 | | |
1940 | 1940 | | |
1941 | 1941 | | |
| 1942 | + | |
| 1943 | + | |
| 1944 | + | |
| 1945 | + | |
| 1946 | + | |
| 1947 | + | |
| 1948 | + | |
| 1949 | + | |
| 1950 | + | |
| 1951 | + | |
1942 | 1952 | | |
1943 | 1953 | | |
1944 | 1954 | | |
| |||
2255 | 2265 | | |
2256 | 2266 | | |
2257 | 2267 | | |
| 2268 | + | |
| 2269 | + | |
| 2270 | + | |
| 2271 | + | |
| 2272 | + | |
| 2273 | + | |
| 2274 | + | |
| 2275 | + | |
| 2276 | + | |
| 2277 | + | |
| 2278 | + | |
| 2279 | + | |
| 2280 | + | |
| 2281 | + | |
| 2282 | + | |
| 2283 | + | |
| 2284 | + | |
| 2285 | + | |
| 2286 | + | |
| 2287 | + | |
| 2288 | + | |
| 2289 | + | |
| 2290 | + | |
| 2291 | + | |
| 2292 | + | |
| 2293 | + | |
| 2294 | + | |
| 2295 | + | |
| 2296 | + | |
2258 | 2297 | | |
2259 | 2298 | | |
2260 | 2299 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
135 | 135 | | |
136 | 136 | | |
137 | 137 | | |
| 138 | + | |
138 | 139 | | |
139 | 140 | | |
140 | 141 | | |
| |||
0 commit comments