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

certificate selection based on supported groups/curves in TLS 1.2 #4274

Open
jmayclin opened this issue Oct 31, 2023 · 3 comments
Open

certificate selection based on supported groups/curves in TLS 1.2 #4274

jmayclin opened this issue Oct 31, 2023 · 3 comments

Comments

@jmayclin
Copy link
Contributor

Problem:

S2N doesn't seem to consider a client's supported_groups when choosing a certificate.

Given an openssl client that only supports the P-384 group and an s2n_server that has an RSA and an ECDSA:P-256 cert configured, the s2n-server should prefer to send the RSA cert since the client has indicated that they don't support P-256.

Reproduction Steps
First, run the generate_certs.sh command from the bench directory.

Then the handshake failure can be observer by running s2nd with an RSA and ECDSA:P-256 cert.

./build/bin/s2nd localhost 9000 --ciphers default_tls13 --cert bindings/rust/bench/certs/rsa2048/server-cert.pem --key bindings/rust/bench/certs/rsa2048/server-key.pem --cert bindings/rust/bench/certs/ecdsa256/server-cert.pem --key bindings/rust/bench/certs/ecdsa256/server-key.pem
openssl s_client -connect localhost:9000 -tls1_2 -groups P-384

If only an RSA cert is configured, then the handshake succeeds.

./build/bin/s2nd localhost 9000 --ciphers default_tls13 --cert bindings/rust/bench/certs/rsa2048/server-cert.pem --key bindings/rust/bench/certs/rsa2048/server-key.pem
openssl s_client -connect localhost:9000 -tls1_2 -groups P-384

Solution:

My understanding is that the supported_groups extension is sent as part of the client hello, so the server should be able to choose a certificate based on the supported_groups extension.

@jmayclin
Copy link
Contributor Author

I was trying to see if we had any integration tests for this case, but it looks like we had previously run into a potentially related problem and documented it here: #2130

@jmayclin
Copy link
Contributor Author

As far as I can tell we don't have integration tests for this case. As a general rule our integration tests do not load multiple certificates, with the exception of test_sni_match.py, but that test uses very permissive clients and as such did not catch this issue.

@csosto-pk
Copy link

Could this be because the second argument in s2nd overrides the RSA passed first?

@jmayclin jmayclin changed the title certificate selection based on supported groups/curves certificate selection based on supported groups/curvesin TLS 1.2 May 24, 2024
@jmayclin jmayclin changed the title certificate selection based on supported groups/curvesin TLS 1.2 certificate selection based on supported groups/curves in TLS 1.2 May 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants