feat: make rustls cert public#858
Conversation
|
@shaneutt |
Thank you for your time @nojima! The primary need is constructing fn ca_from_cached(
cached: &praxis_tls::CachedCaCerts,
) -> Vec<pingora_core::utils::tls::WrappedX509> {
cached
.der_certs()
.iter()
.map(|der| {
pingora_core::utils::tls::WrappedX509::new(
der.clone(),
pingora_core::utils::tls::parse_x509,
)
})
.collect()
}Called during upstream peer selection to populate per-cluster CA roots. So what this PR provides, broken down:
Items 1 and 2 are strictly required for our use case. Item 3 is not something we use today, but it seems generally useful for any downstream that needs to inspect certificate contents after construction. Let me know your thoughts? And again, thank you for your time 🙇 |
|
@shaneutt The approach makes sense, but I have a slight concern about the public API surface. I consider the fact that impl WrappedX509 {
pub fn parse(raw_cert: Vec<u8>) -> Self {
Self::new(raw_cert, parse_x509)
}
...
}With this function, you can create As for use case 3, we could support it by adding a new method rather than making the fields public: pub fn parsed(&self) -> &X509Certificate<'_> {
self.borrow_cert()
}This approach avoids exposing the various ouroboros-generated methods, leaving us with more flexibility for future design decisions. That said, I'm hesitant about implementing use case 3 right now. Removing a public function once it's been published is generally difficult. If you don't have an immediate need for it, I think it would be fine to address only use cases 1 and 2 in this PR and leave 3 for later. |
Adapted from cloudflare#726. Allows full control over the rustls ServerConfig, including 0-RTT, session resumption, and custom certificate resolvers.
Signed-off-by: Shane Utt <shaneutt@linux.com>
Signed-off-by: Shane Utt <shaneutt@linux.com>
Signed-off-by: Shane Utt <shaneutt@linux.com>
875e4d9 to
514d06b
Compare
Sounds good 👍 Switched to that approach, and pushed it up. LMKWYT.
|
This enables a deeper level of control from implementations utilizing Pingora over certificates.
This is being paired with #726 in our fork right now.