s2n-quic icon indicating copy to clipboard operation
s2n-quic copied to clipboard

Add client authentication support for rustls

Open thynson opened this issue 1 year ago • 6 comments

Description of changes:

This PR adds support of client authentication to s2n-quic-rustls

Call-outs:

Testing:

I can write an example for it, but I'm not sure how it's tested automatically yet.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

thynson avatar Feb 16 '24 08:02 thynson

Note that it is already possible to do client authentication in s2n-quic using rustls. Here's an example of how it's done: https://github.com/aws/s2n-quic/tree/main/examples/rustls-mtls. It involves implementing a TLS provider in order to enable client auth in rustls. Is there some reason why that example doesn't work for you/why you need to add this feature to the s2n-quic-rustls crate?

Edit: Actually, we should probably enable client auth in rustls without having to impl the TLS provider. The rustls client auth example we have is a bit heavy handed.

maddeleine avatar Feb 19 '24 18:02 maddeleine

Of course anyone can use their own Provider to implement mTLS, but why not to make it into the s2n-quic-rustls, so that it can be as easy as using s2n-quic-tls?

thynson avatar Feb 20 '24 01:02 thynson

We're wanting to update the rustls dependency first (see #2143) and then we can get this change in

camshaft avatar Mar 07 '24 18:03 camshaft

I'll continue this PR after #2143 merged, and I want to resolve #1957 in this PR too.

thynson avatar Mar 08 '24 08:03 thynson

The rustls-mtls example was updated to demonstrate the stuffes introduced in this PR.

Some off-topic thoughts: IntoCertificate and IntoPrivateKey make it easier to deal with certificates and keys. However, their behavior depends on the filename extension and performs sync filesystem I/O. Probably it'd be better to expose some low-level API that accepts CertificateDer and PrivateKeyDer instead.

thynson avatar Mar 24 '24 14:03 thynson

I'll continue this PR after https://github.com/aws/s2n-quic/pull/2143 merged, and I want to resolve https://github.com/aws/s2n-quic/issues/1957 in this PR too.

Regarding #1957, correct me if I'm wrong, but it seems not only an issue for rustls, but also applies to s2n-tls. Some change to Connection needs to be made before it can be implemented, which is out of my ability and interest currently.

thynson avatar Mar 24 '24 14:03 thynson