-
Notifications
You must be signed in to change notification settings - Fork 726
client certificate revocation checking support. #1326
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Codecov Report
@@ Coverage Diff @@
## main #1326 +/- ##
==========================================
+ Coverage 95.88% 95.93% +0.05%
==========================================
Files 61 61
Lines 14591 14750 +159
==========================================
+ Hits 13990 14150 +160
+ Misses 601 600 -1
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
PR description updated. Also required a 2nd Cargo patch for rustls-pemfile until we cut a release w/ CRL support. |
In addition to the I will note both aspects in the changelog 👍 |
13cdbe9
to
14ed8be
Compare
Rebased, updated the webpki patch to use One other substantial change: based on experience integrating this work in Initially I provided
Let me know what you think. I can go back to the previous approach if folks dislike this variation. |
I commented on this before seeing this discussion:
Not sure this is a great argument? One would argue that it might be useful for downstream consumers to notice they now have the option to provide a CRL.
Why is it a pain? Maybe the right path forward is to provide a |
I'll give that a shot. I think it's a nicer API. |
I'll see about shoring up the test coverage. Otherwise I think this is ready for review with all existing review feedback addressed. With the webpki 0.101.0 release being available I removed the cargo patch and moved this out of draft status. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm! for the coverage gaps i'd consider some unit-test-style direct exercise of the error types.
e018bfc
to
39964f9
Compare
Some more unit tests did the trick 👍 |
This commit updates the webpki dependency of rustls to v0.101.0, the release that adds CRL support.
This commit introduces a `crls: Vec<webpki::OwnedCertRevocationList>>` field to the `AllowAnyAuthenticatedClient` implementation of `ClientCertVerifier` in preparation of supporting revocation checking of client certs with CRLs. Each impl gets a builder-style `with_crls` method that can be used to augment the verifier with CRLs to use for client cert revocation status checking. The constructed cert revocation lists are provided to webpki at cert verification time to use for revocation lookup. The `tlsserver-mio` example is updated with a `--crl` flag to the that can be used to optionally provide a series of DER encoded CRLs to use for client certificate revocation checking.
This commit updates the `build-a-pki.sh` script to generate example certificate revocation lists (CRLs) that mark each of the client certificates as revoked. These can be used by server tests to ensure CRL validation works as expected. The process of generating CRLs using `openssl` is... well... not great... It can't be done without using `openssl ca`, which in turn requires using an `openssl.cnf` with all the associated warts. I've done my best to create the absolute minimum configuration that can be used for our purposes. Using `openssl ca` also requires writing some intermediate state. The script is updated to create/delete this state through the process of generating the CRLs. This should be sufficient for our needs. Blech.
Generated with: ``` cd test-ca ./build-a-pki.sh git add . ```
This commit introduces `api.rs` integration tests that verify a server configured with client authentication (mandatory or optional), and a CRL that specifies a client cert as revoked, will correctly return a revoked error for that client cert. In addition to the test CRL data generated in a previous commit this work requires `rustls-pemfile` >= 1.0.3 to use unreleased CRL support in the `rustls-pemfile` crate. The rustls dev-dependency and the rustls example dependency on this crate are adjusted accordingly.
Includes: * CRL feature for the client verifiers. * Certificate validation helpers when using `dangerous_configuration` feature.
Description
This branch builds on the webpki CRL support added in v0.101.0 to offer client certificate revocation checking with the Rustls
AllowAnyAuthenticatedClient
andAllowAnyAnonymousOrAuthenticatedClient
implementations of theClientCertVerifier
trait.This replaces #1322:
with_crls
fn on the verifiers to optionally provide CRLs.deps: update rustls-webpki.
This commit updates the webpki dependency of rustls to v0.101.0, the release that adds CRL support.
verify: AllowAnyAuthenticatedClient CRLs.
This commit introduces a
crls: Vec<webpki::OwnedCertRevocationList>>
field to theAllowAnyAuthenticatedClient
implementation ofClientCertVerifier
in preparation of supporting revocation checking of client certs with CRLs.Each impl gets a builder-style
with_crls
method that can be used to augment the verifier with CRLs to use for client cert revocation status checking.The constructed cert revocation lists are provided to webpki at cert verification time to use for revocation lookup.
The
tlsserver-mio
example is updated with a--crl
flag to the that can be used to optionally provide a series of DER encoded CRLs to use for client certificate revocation checking.test-ca: generate demo CRLs for client certs.
This commit updates the
build-a-pki.sh
script to generate example certificate revocation lists (CRLs) that mark each of the client certificates as revoked. These can be used by server tests to ensure CRL validation works as expected.The process of generating CRLs using
openssl
is... well... not great...It can't be done without using
openssl ca
, which in turn requires using anopenssl.cnf
with all the associated warts. I've done my best to create the absolute minimum configuration that can be used for our purposes.Using
openssl ca
also requires writing some intermediate state. The script is updated to create/delete this state through the process of generating the CRLs. This should be sufficient for our needs. Blech.test-ca: regenerate certs, keys, crls.
Generated with:
tests: integration test for revoked client certs.
This commit introduces
api.rs
integration tests that verify a server configured with client authentication (mandatory or optional), and a CRL that specifies a client cert as revoked, will correctly return a revoked error for that client cert.In addition to the test CRL data generated in a previous commit this work requires
rustls-pemfile
>= 1.0.3 to use unreleased CRL support in therustls-pemfile
crate. The rustls dev-dependency and the rustls example dependency on this crate are adjusted accordingly.docs: update README changelog for 0.21.3.
Includes:
dangerous_configuration
feature.