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

Allow TLS PSK without server certificate #2083

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

WillChilds-Klein
Copy link
Contributor

@WillChilds-Klein WillChilds-Klein commented Dec 28, 2024

Description of changes:

While we currently support TLS pre-shared keys (PSKs) for TLS 1.2, our
python integration tests have shown that we don't currently support TLS 1.2
PSKs on the server side unless a certificate has been configured. PSKs can be
used for both secret establishment and authentication, so there likely exist
legitimate use-cases for establishing PSK connections without certificates.
CPython's integration tests expect this behavior.

This gap appears to be incidental, not intentional. Unrelated OCSP work
introduced a requirement that a valid certificate public key is loaded on the
server before we sort out handshake parameters. If that load fails, the
hanshake is aborted before PSK can be negotiated for secret establishment. To
fix this, we simply check whether the server has a PSK callback enabled, and
allow the certificate loading to fail if so. We also handle the potential
nullity of the public key.

Call-outs:

This PR only applies to TLSv1.2 PSK. TLSv1.3 moved PSK negotiation earlier in
the handshake to client/server hello's, so does utilize this code path.
Currently, we only support TLSv1.3 PSK for session resumption, _not "pure" PSK
used for initial shared secret establishment. I have a branch where I'm
implementing this, but it's non-trivial.

We won't be able to delete the TLSv1.3 PSK python test patch until we implement
"pure" TLSv1.3 PSK.

Testing:

  • CI

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

@WillChilds-Klein WillChilds-Klein changed the title Allow TLS PSK without server certificate [DRAFT] Allow TLS PSK without server certificate Dec 28, 2024
@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 78.74%. Comparing base (39b3fae) to head (c0f062e).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2083      +/-   ##
==========================================
- Coverage   78.75%   78.74%   -0.01%     
==========================================
  Files         598      598              
  Lines      103650   103652       +2     
  Branches    14718    14719       +1     
==========================================
- Hits        81633    81625       -8     
- Misses      21366    21372       +6     
- Partials      651      655       +4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@WillChilds-Klein WillChilds-Klein changed the title [DRAFT] Allow TLS PSK without server certificate Allow TLS PSK without server certificate Dec 28, 2024
@WillChilds-Klein WillChilds-Klein marked this pull request as ready for review December 30, 2024 16:12
@WillChilds-Klein WillChilds-Klein requested a review from a team as a code owner December 30, 2024 16:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants