cloudflare / cloudflare/quiche

C example client: SSL key log file is not working

Open
#1,286 2 comments 1 reaction 0 assignees View on GitHub
Dominant language
Rust
Stars
11.8k
Forks
1.1k
Avg merge
21h 9m
Merged PRs (30d)
6

Description

The example C client implementation proposes to enable TLS key logging via an environmental variable `SSLKEYLOGFILE`.
However, it does not seem to work. Checked both on MacOS, Ubuntu and Windows.
Looks like just calling `quiche_config_log_keys(config)` is not enough, as there should be some `keylog` file created by the app as well. Not sure how to pass it to quiche though.
In the RUST client it is done the following way:

```rust
if let Some(keylog) = &mut keylog {
if let Ok(keylog) = keylog.try_clone() {
conn.set_keylog(Box::new(keylog));
}
}
```

### Proposed Fix

Seems to work when `quiche_conn_set_keylog_path(..)` is used additionaly.

```c
quiche_conn *conn = quiche_connect(host, (const uint8_t *) scid, sizeof(scid),
(struct sockaddr *) &conn_io->local_addr,
conn_io->local_addr_len,
peer->ai_addr, peer->ai_addrlen, config);

if (conn == NULL) {
fprintf(stderr, "failed to create connection\n");
return -1;
}

if (getenv("SSLKEYLOGFILE")) {
if (!quiche_conn_set_keylog_path(conn, getenv("SSLKEYLOGFILE")))
fprintf(stderr, "Failed to configure the TLS key log file.\n");
else {
fprintf(stderr, "TLS key logging enabled!\n");
quiche_config_log_keys(config);
}
}
```

Contributor guide

Open the contributing guide

Research direction

Start with the C example client and trace the SSLKEYLOGFILE handling, then compare it with the Rust client’s keylog setup and the quiche_conn_set_keylog_path and quiche_config_log_keys APIs. Verify the resulting behavior on the reported platforms, with done meaning that setting SSLKEYLOGFILE creates a usable TLS key log file.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, rust
Domain
networking
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.