Commit 0110e9f
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 0110e9f
4 files changed
Lines changed: 428 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4060 | 4060 | | |
4061 | 4061 | | |
4062 | 4062 | | |
| 4063 | + | |
4063 | 4064 | | |
4064 | 4065 | | |
4065 | 4066 | | |
| |||
8126 | 8127 | | |
8127 | 8128 | | |
8128 | 8129 | | |
| 8130 | + | |
8129 | 8131 | | |
8130 | 8132 | | |
8131 | 8133 | | |
| |||
8365 | 8367 | | |
8366 | 8368 | | |
8367 | 8369 | | |
| 8370 | + | |
| 8371 | + | |
| 8372 | + | |
| 8373 | + | |
| 8374 | + | |
| 8375 | + | |
| 8376 | + | |
| 8377 | + | |
| 8378 | + | |
| 8379 | + | |
| 8380 | + | |
| 8381 | + | |
| 8382 | + | |
| 8383 | + | |
| 8384 | + | |
| 8385 | + | |
| 8386 | + | |
| 8387 | + | |
| 8388 | + | |
| 8389 | + | |
| 8390 | + | |
| 8391 | + | |
| 8392 | + | |
| 8393 | + | |
| 8394 | + | |
| 8395 | + | |
| 8396 | + | |
| 8397 | + | |
| 8398 | + | |
| 8399 | + | |
8368 | 8400 | | |
8369 | 8401 | | |
8370 | 8402 | | |
| |||
8394 | 8426 | | |
8395 | 8427 | | |
8396 | 8428 | | |
8397 | | - | |
| 8429 | + | |
| 8430 | + | |
| 8431 | + | |
| 8432 | + | |
8398 | 8433 | | |
8399 | 8434 | | |
8400 | 8435 | | |
| |||
| 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