Skip to content
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

Make S2N_CERT_AUTH_OPTIONAL the default for clients #4390

Merged
merged 5 commits into from
Mar 21, 2024

Conversation

lrstewart
Copy link
Contributor

@lrstewart lrstewart commented Jan 30, 2024

Resolved issues:

resolves #4382

Description of changes:

Currently, the default client behavior is to consider a CertificateRequest an unexpected message / error, since client auth is completely disabled by default. That seems wrong, since a server can request a certificate without actually requiring the client to provide a certificate, and a client can't necessarily predict the server behavior. That was apparently the use case behind the original work to make clients support S2N_AUTH_TYPE_OPTIONAL. I talked to alexw91, who did the original S2N_AUTH_TYPE_OPTIONAL work for clients, and he doesn't remember a specific reason for not changing the default behavior. He pointed me towards this conversation.

This PR changes the default client behavior so that a client will instead respond to a CertificateRequest with an empty Certificate message. The old behavior is still possible if explicitly configured.

Call-outs:

I have two concerns with this change:

This is a behavior change. If a customer wasn't calling set_client_auth_type because they specifically wanted their clients to error on receiving a CertificateRequest, we have now broken that customer. That sounds like a strange use case to me, but I can't say for sure that no customer is doing that. I'm torn on whether this change is worth the risk.

s2n_config_get_client_auth_type is now somewhat misleading. It reports the client_cert_auth_type even if no override was set and the client_cert_auth_type will therefore be ignored. I think the more correct behavior would be an error, but that would likely break a customer who calls s2n_config_get_client_auth_type for all connections (like maybe for metrics). I think we have to leave the odd behavior as-is.

Testing:

Unit tests

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

@github-actions github-actions bot added the s2n-core team label Jan 30, 2024
@lrstewart lrstewart force-pushed the auth_type branch 4 times, most recently from fdcc85f to 7f02f8e Compare February 1, 2024 07:26
The experimental SAW bitfield features seems broken :/
@lrstewart
Copy link
Contributor Author

I was having some real trouble with the SAW proofs. I think something strange is going on with bitfield support, which to be fair is experimental.

I initially tried to use bitfields for both the config and connection, but:

@lrstewart lrstewart marked this pull request as ready for review March 12, 2024 20:39
tls/s2n_config.h Show resolved Hide resolved
tls/s2n_config.c Show resolved Hide resolved
Copy link
Contributor

@camshaft camshaft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good! I don't follow the saw changes enough to review that but the rest looks correct.

@pennyannn
Copy link
Contributor

I was having some real trouble with the SAW proofs. I think something strange is going on with bitfield support, which to be fair is experimental.

I initially tried to use bitfields for both the config and connection, but:

@lrstewart , I have tried an experiment where I changed client_cert_auth_type_overridden to be bitfield, and I also get errors. It seems like the bitfield feature is indeed flaky. Maybe newer versions of SAW could help but I'm not sure.

@lrstewart
Copy link
Contributor Author

@lrstewart , I have tried an experiment where I changed client_cert_auth_type_overridden to be bitfield, and I also get errors. It seems like the bitfield feature is indeed flaky. Maybe newer versions of SAW could help but I'm not sure.

I just tried with 1.1. Same error :(

@lrstewart lrstewart enabled auto-merge (squash) March 20, 2024 17:25
@lrstewart lrstewart merged commit 3926a45 into aws:main Mar 21, 2024
31 checks passed
@lrstewart lrstewart deleted the auth_type branch March 21, 2024 09:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make S2N_CERT_AUTH_OPTIONAL the default for clients
4 participants