From f86793e8f2493009cc270df899759e4d716abdeb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pascal=20Eng=C3=A9libert?= Date: Tue, 20 Jan 2026 16:41:17 +0100 Subject: [PATCH] SSLKEYLOGFILE --- README.md | 4 ++++ src/client.rs | 10 +++++++++- src/server.rs | 1 + 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index bebd67c..5cb5ec8 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,10 @@ The record file is a list of records. Each record follows this format: * [8 bytes] data length, big endian * data +## SSLKEYLOGFILE + +The `SSLKEYLOGFILE` environment variable can be set to a file path to which the connection secrets will be exported, enabling decrypting the traffic in Wireshark. + ## License GNU AGPL v3, CopyLeft 2025 Pascal Engélibert [(why copyleft?)](https://txmn.tk/blog/why-copyleft/) diff --git a/src/client.rs b/src/client.rs index f19dbf8..01733ee 100644 --- a/src/client.rs +++ b/src/client.rs @@ -122,6 +122,7 @@ pub async fn play( } else { config.resumption = Resumption::disabled(); } + config.key_log = Arc::new(tokio_rustls::rustls::KeyLogFile::new()); let config = Arc::new(config); for (id, (server_name, records)) in records.iter() { let connector = TlsConnector::from(config.clone()); @@ -322,7 +323,8 @@ pub async fn play( ) .await { - Ok(v) => v.unwrap().unwrap(), + Ok(None) => break, + Ok(Some(v)) => v.unwrap(), Err(_e) => { // TODO fix println!( @@ -350,6 +352,12 @@ pub async fn play( //crate::http::decode_http(&mut buf, &mut stream).await; //buf.clear(); } + if total_recv < reduced_len { + println!( + "({}) RECV NOT ENOUGH {} / {}", + id, total_recv, total_len + ); + } } } } diff --git a/src/server.rs b/src/server.rs index 2ba5979..6f85ebc 100644 --- a/src/server.rs +++ b/src/server.rs @@ -141,6 +141,7 @@ pub async fn play( .with_no_client_auth() .with_cert_resolver(Arc::new(resolver)); config.max_early_data_size = 8192; + config.key_log = Arc::new(tokio_rustls::rustls::KeyLogFile::new()); let config = Arc::new(config); let listener = TcpListener::bind(listen_addr).await.unwrap();