Skip to content

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

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

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant