feature: add server random and master key fetch api#523
Closed
theweakgod wants to merge 1 commit intoopenresty:masterfrom
Closed
feature: add server random and master key fetch api#523theweakgod wants to merge 1 commit intoopenresty:masterfrom
theweakgod wants to merge 1 commit intoopenresty:masterfrom
Conversation
ec6bd55 to
cc810be
Compare
79bb140 to
95b12ac
Compare
c3c81b3 to
3b41bef
Compare
zhuizhuhaomeng
approved these changes
Mar 24, 2026
Contributor
|
This feature has been merged |
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.
What
Add two new FFI-based Lua APIs to the
ngx.sslmodule:get_server_random([outlen])— returns the server random (default 32 bytes) from the current SSL connection, wrapping OpenSSL'sSSL_get_server_random().get_session_master_key([outlen])— returns the master secret (default 48 bytes, i.e.SSL_MAX_MASTER_KEY_LENGTH) from the current SSL session, wrapping OpenSSL'sSSL_SESSION_get_master_key().Both follow the same calling convention as the existing
get_client_random(): pass0to get the length, passnilor omit to get the value with the default size.Why
The
ngx.sslmodule already exposesget_client_random(), but server random and master key are missing. All three are required to produce an NSS Key Log entry:This file format is supported by Wireshark for decrypting TLS 1.2 traffic captures. Without this PR, users have to resort to
LD_PRELOADhacks, eBPF tools, or NGINX Plus (ssl_key_log/proxy_ssl_key_logdirectives) to obtain the same data.Usage
Produce a Wireshark-compatible key log line: