Skip to content

feature: add server random and master key fetch api#2484

Open
theweakgod wants to merge 2 commits intoopenresty:masterfrom
theweakgod:master
Open

feature: add server random and master key fetch api#2484
theweakgod wants to merge 2 commits intoopenresty:masterfrom
theweakgod:master

Conversation

@theweakgod
Copy link
Contributor

What

Add two new C-side FFI functions to support the corresponding Lua API in lua-resty-core's ngx.ssl module:

  • ngx_http_lua_ffi_ssl_server_random(r, out, outlen, err) — retrieves the server random value via OpenSSL's SSL_get_server_random().
  • ngx_http_lua_ffi_ssl_session_master_key(r, out, outlen, err) — retrieves the session master key via OpenSSL's SSL_SESSION_get_master_key().

Both functions follow the same signature and behavior as the existing ngx_http_lua_ffi_ssl_client_random().

Why

The ngx.ssl module in lua-resty-core currently only exposes get_client_random(). To construct a complete NSS Key Log entry for Wireshark TLS decryption, the server random and master key are also needed:

CLIENT_RANDOM <client_random_hex> <master_key_hex>

This enables users to debug HTTPS traffic in Lua without recompiling Nginx, using LD_PRELOAD, or relying on NGINX Plus commercial directives.

@theweakgod theweakgod changed the title feat: add server random and master key fetch api draft: add server random and master key fetch api Mar 16, 2026
@theweakgod theweakgod changed the title draft: add server random and master key fetch api feature: add server random and master key fetch api Mar 16, 2026
@theweakgod theweakgod marked this pull request as draft March 16, 2026 15:15
@theweakgod theweakgod force-pushed the master branch 2 times, most recently from 3fd83ee to 2400216 Compare March 22, 2026 05:41
@theweakgod theweakgod marked this pull request as ready for review March 22, 2026 05:58
@theweakgod theweakgod force-pushed the master branch 2 times, most recently from 9810111 to 139425b Compare March 22, 2026 06:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant