From befd8d4bd2d4044f3738b7277d2bbda37cc2f63a Mon Sep 17 00:00:00 2001 From: Tamas Levai Date: Wed, 21 Feb 2024 11:37:40 +0100 Subject: [PATCH] net/quic: Allow SSL keylog file for debugging rustls has a KeyLog implementation that opens a file whose name is given by the `SSLKEYLOGFILE` environment variable, and writes keys into it. If SSLKEYLOGFILE is not set, this does nothing. See https://docs.rs/rustls/latest/rustls/struct.KeyLogFile.html https://docs.rs/rustls/latest/rustls/trait.KeyLog.html Part-of: --- net/quic/src/utils.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/net/quic/src/utils.rs b/net/quic/src/utils.rs index c9da4a3f..1d2ab185 100644 --- a/net/quic/src/utils.rs +++ b/net/quic/src/utils.rs @@ -144,6 +144,7 @@ fn configure_client(secure_conn: bool, alpns: Vec) -> Result>(); crypto.alpn_protocols = alpn_protocols; + crypto.key_log = Arc::new(rustls::KeyLogFile::new()); Ok(ClientConfig::new(Arc::new(crypto))) } @@ -234,6 +235,7 @@ fn configure_server( .map(|x| x.as_bytes().to_vec()) .collect::>(); crypto.alpn_protocols = alpn_protocols; + crypto.key_log = Arc::new(rustls::KeyLogFile::new()); let mut server_config = ServerConfig::with_crypto(Arc::new(crypto)); Arc::get_mut(&mut server_config.transport)