maskit opened a new pull request, #14129: URL: https://github.com/apache/trafficserver/pull/14129
A certificate replaced through `TSSslServerCertUpdate` (for example with the `cert_update` plugin) kept the OCSP stapling setup of the certificate it replaced and never got its own. `SSLCreateServerContext` builds the replacement context from the line's configuration, which sets up stapling for the line's certificates, and then loads the new certificate and key over it. The result depended on the TLS library: - BoringSSL builds stapled the replaced certificate's OCSP response with the new certificate, so clients that check the staple against the certificate saw a mismatch. - OpenSSL builds stapled nothing for the new certificate and logged `ssl_callback_ocsp_stapling: failed to get certificate information` on every handshake that asked for a staple. After loading the new certificate, `SSLCreateServerContext` now drops the stapling entries of the certificates it replaced and sets up stapling for the new one. Only the new leaf is loaded, so its issuer has to be in the line's chain or the certificate store, as for the line's own certificates. The new certificate's response is fetched from its own responder at the next OCSP refresh; the line's prefetched `ssl_ocsp_name` response belongs to the old certificate and is not used. Until a refresh succeeds, nothing is stapled for it and `failed to get certificate status` is logged, rate-limited. On OpenSSL builds, which serve all certificates of a line from one context, replacing one keeps the others' stapling. Other builds serve one certificate per context, so all of that context's entries belong to the replaced certificate and are dropped, including when the replacement is byte-identical to it. The per-context stapling map now holds a reference on each certificate on both libraries, as it already did on BoringSSL, so an entry can outlive the certificate the context stops serving until it is removed. This removes two library-specific blocks. Not addressed here: on BoringSSL builds, `TSSslServerCertUpdate` still cannot find a line whose certificate is EC, because its name lookup only searches the RSA contexts. ## Testing New `tls/test_tls_ocsp_cert_update.py`, on TLS 1.2 and 1.3: - A line with a prefetched OCSP response gets its certificate replaced through `cert_update`. Afterwards the client gets the new certificate, stapling is set up for it, and nothing is stapled with it (its responder is unreachable in the test). Without the fix this fails on both BoringSSL and OpenSSL 4 builds; with it, it passes. - OpenSSL builds only: on an RSA+EC line, replacing the RSA certificate gives RSA clients the new certificate with no staple and keeps the EC certificate's staple for ECDSA clients. This case fails if the EC certificate's entry is dropped along with the replaced one. `tls/test_tls_ocsp.py` and `pluginTest/cert_update` pass on both builds. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
