[control] Fix round 1: changes apply while Caddy serves (admin socket, watch through Caddy), revocations that fail are errors and catch up, proof only on the forward-auth UI host, root keys found by content, intermediates checked before install, stale SNI cleared before each handshake
This commit is contained in:
@@ -48,6 +48,8 @@ impl CertStore {
|
||||
impl ResolvesServerCert for CertStore {
|
||||
fn resolve(&self, hello: ClientHello<'_>) -> Option<Arc<CertifiedKey>> {
|
||||
// No SNI or an unknown name: no certificate, the handshake fails (as with Caddy).
|
||||
// Whatever an earlier handshake on this thread left is not this one's.
|
||||
let _ = take_hello_sni();
|
||||
let name = hello.server_name()?.to_ascii_lowercase();
|
||||
let found = match self.files.load().get(&name) {
|
||||
Some(k) => Some(k.clone()),
|
||||
@@ -102,6 +104,30 @@ fn take_hello_sni() -> Option<String> {
|
||||
HELLO_SNI.with(|s| s.borrow_mut().take())
|
||||
}
|
||||
|
||||
/// Call before each TLS handshake, on the thread that creates its `ServerConnection` (edge
|
||||
/// does it in a pre-TLS hook): a handshake that ended after the certificate resolver but
|
||||
/// before the certificate request (failed, or resumed) leaves its name behind, and rustls asks
|
||||
/// the verifier once more when the next connection is created, before that connection's
|
||||
/// hello is read. A stale name there would turn off the TLS 1.2 transcript a client
|
||||
/// certificate needs.
|
||||
pub fn begin_handshake() {
|
||||
let _ = take_hello_sni();
|
||||
}
|
||||
|
||||
/// The pre-TLS hook that calls [`begin_handshake`].
|
||||
pub struct HandshakeStart;
|
||||
|
||||
#[async_trait::async_trait]
|
||||
impl pingora::listeners::PreTlsProcess for HandshakeStart {
|
||||
async fn process(
|
||||
&self,
|
||||
_stream: &mut pingora::protocols::l4::stream::Stream,
|
||||
) -> pingora::Result<()> {
|
||||
begin_handshake();
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
/// What one config says about device certificates.
|
||||
pub struct DeviceTrust {
|
||||
inner: Arc<dyn ClientCertVerifier>,
|
||||
|
||||
Reference in New Issue
Block a user