Skip to content

sslkeylog: add support to enable or disable SSL key log before node connection - #3556

Open
VaibhavTekale1 wants to merge 38 commits into
warmcat:mainfrom
VaibhavTekale1:feat/sslkeylogging-runtime-enable-disable
Open

VaibhavTekale1 wants to merge 38 commits into
warmcat:mainfrom
VaibhavTekale1:feat/sslkeylogging-runtime-enable-disable

Conversation

@VaibhavTekale1

@VaibhavTekale1 VaibhavTekale1 commented Mar 17, 2026 •

Copy link
Copy Markdown

Summary
Added a context-level runtime API to control TLS key logging without requiring a live wsi.
This addresses the gap where key logging could not be toggled cleanly at runtime at context scope.
The API supports both enable and disable behavior through one entry point.
Changes

Implemented ws_ctx_set_reset_keylog_file(context, ssl_key_file_path) in libwebsockets core logic.
Updated BACnet integration to call this API from context path in lwscontext.c when wsi is not available.
Kept existing wsi-based flow unchanged, and used context-based fallback only when needed.
Public API Details

API name: lws_ctx_set_reset_keylog_file
Signature: takes struct lws_context *context and const char *ssl_key_file_path
Behavior:

  • Non-NULL path: enables/updates key logging file at context level

  • NULL path: clears/disables key logging at context level
    Intended usage: runtime key logging control for client/server flows that only have context handle.

Advantages:
Runtime enable/disable support at context level.
Single generic API for set and reset reduces integration complexity.
Works even before/without per-connection wsi availability.
Improves operability for debugging TLS traffic in long-running systems without restart.

lws-team added 30 commits March 14, 2026 18:01
Add a generic DTLS wrapper to lws that is able to work using any of the
supported tls libraries as the backed: openssl (and variants), mbedtls,
gnutls, schannel

Note that schannel is not able to work with webrtc due to schannel api's
own limitations.  You must use openssl or mbedtls for windows if you want
to use dtls for webrtc.
This adds support for webrtc serving along with ALSA, OPUS, V4L2, TRANSCODE
and other critical pieces
Having added a member to lws_plugin_protocol, it's a good time to change
the old struct initializer format to C9, since we'll have to visit them all
anyway.

Also modernize the event lib struct while we're at it.
Various things that Sai identified needed fixing
@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
E Reliability Rating on New Code (required ≥ A)
D Security Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

goto failed;
}

n = sprintf(buf, "%d", ac->len);
mkdir(vhd->storage_path, 0777);
lwsl_user("%s: PUT targeting filepath: %s\n", __func__, path);

if (mkdir(vhd->storage_path, 0777) < 0 && errno != EEXIST) {
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.

3 participants