cloudflare / cloudflare/pingora
feat(rustls): Expose negotiated key exchange group in SslDigest
- Dominant language
- Rust
- Stars
- 27.4k
- Forks
- 1.7k
- Avg merge
- 6h 22m
- Merged PRs (30d)
- 3
Description
## Use Case
We are implementing NIST SP 1800-37 *Addressing Visibility Challenges with TLS 1.3* forensic logging in a gateway built on Pingora. We need to log the negotiated key exchange group per connection to monitor post-quantum cryptography migration progress (per NIST IR 8547).
## Problem
`SslDigest` currently exposes `cipher` and `version`, but not the negotiated key exchange group. In rustls 0.23, this information is available via `ServerConnection::negotiated_kx_group()`, but Pingora does not expose the `ServerConnection` post-handshake, and `TlsSettings` constructs the `ServerConfig` internally with no user hook point.
## Proposed Solution (minimal, non-breaking)
Add an optional `kx_group` field to `SslDigest`:
`
ust
pub struct SslDigest {
pub cipher: Cow<'static, str>,
pub version: Cow<'static, str>,
pub kx_group: Option>, // NEW
pub organization: Option,
pub serial_number: Option,
pub cert_digest: Vec,
pub extension: SslDigestExtension,
}
`
Populate it from `ServerConnection::negotiated_kx_group()` (rustls) or the equivalent OpenSSL/BoringSSL call in the respective TLS stream implementation after handshake completes.
## Alternative (more flexible)
Allow users to provide a pre-built `Arc` to `TlsSettings`:
`
ust
impl TlsSettings {
pub fn from_server_config(config: Arc) -> Self;
}
`
This would enable custom `KeyLog` implementations, custom `CryptoProvider`, and other advanced TLS configuration use cases.
## Context
- Pingora version: 0.8.1
- rustls version: 0.23.x
- The `kx_group` is metadata only (no security implication to exposing it in the digest)
- Useful for: compliance logging, post-quantum migration monitoring, observability dashboards
- Related standards: NIST SP 1800-37, NIST IR 8547, NIST SP 800-52 Rev 2
Contributor guide
Research direction
Start at SslDigest and trace the TLS stream implementations through handshake completion, including the rustls ServerConnection::negotiated_kx_group() entry point and the TlsSettings construction path. Compare the rustls and OpenSSL/BoringSSL paths, then verify that the negotiated group is available in the digest without changing existing fields or behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- networking, observability, security
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100