SSLKEYLOGFILE

This commit is contained in:
Pascal Engélibert 2026-01-20 16:41:17 +01:00
commit f86793e8f2
3 changed files with 14 additions and 1 deletions

View file

@ -26,6 +26,10 @@ The record file is a list of records. Each record follows this format:
* [8 bytes] data length, big endian * [8 bytes] data length, big endian
* data * 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 ## License
GNU AGPL v3, CopyLeft 2025 Pascal Engélibert [(why copyleft?)](https://txmn.tk/blog/why-copyleft/) GNU AGPL v3, CopyLeft 2025 Pascal Engélibert [(why copyleft?)](https://txmn.tk/blog/why-copyleft/)

View file

@ -122,6 +122,7 @@ pub async fn play(
} else { } else {
config.resumption = Resumption::disabled(); config.resumption = Resumption::disabled();
} }
config.key_log = Arc::new(tokio_rustls::rustls::KeyLogFile::new());
let config = Arc::new(config); let config = Arc::new(config);
for (id, (server_name, records)) in records.iter() { for (id, (server_name, records)) in records.iter() {
let connector = TlsConnector::from(config.clone()); let connector = TlsConnector::from(config.clone());
@ -322,7 +323,8 @@ pub async fn play(
) )
.await .await
{ {
Ok(v) => v.unwrap().unwrap(), Ok(None) => break,
Ok(Some(v)) => v.unwrap(),
Err(_e) => { Err(_e) => {
// TODO fix // TODO fix
println!( println!(
@ -350,6 +352,12 @@ pub async fn play(
//crate::http::decode_http(&mut buf, &mut stream).await; //crate::http::decode_http(&mut buf, &mut stream).await;
//buf.clear(); //buf.clear();
} }
if total_recv < reduced_len {
println!(
"({}) RECV NOT ENOUGH {} / {}",
id, total_recv, total_len
);
}
} }
} }
} }

View file

@ -141,6 +141,7 @@ pub async fn play(
.with_no_client_auth() .with_no_client_auth()
.with_cert_resolver(Arc::new(resolver)); .with_cert_resolver(Arc::new(resolver));
config.max_early_data_size = 8192; config.max_early_data_size = 8192;
config.key_log = Arc::new(tokio_rustls::rustls::KeyLogFile::new());
let config = Arc::new(config); let config = Arc::new(config);
let listener = TcpListener::bind(listen_addr).await.unwrap(); let listener = TcpListener::bind(listen_addr).await.unwrap();