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

chore(deps): Upgrade tokio-rustls to 0.26 #3419

Merged
merged 7 commits into from
Dec 11, 2024
Merged

Conversation

sfleen
Copy link
Collaborator

@sfleen sfleen commented Dec 4, 2024

This bumps rustls itself from 0.21 to 0.23, which comes with a few breaking API changes. Most of these are limited to types being moved or renamed, or how the certificate verifiers are constructed.

Copy link
Member

@olix0r olix0r left a comment

Choose a reason for hiding this comment

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

Consider pulling the rustls dependencies up to the workload (/Cargo.toml) so we can pin the featureset in one place

linkerd/app/outbound/Cargo.toml Outdated Show resolved Hide resolved
linkerd/meshtls/rustls/Cargo.toml Outdated Show resolved Hide resolved
rustls::ServerConfig::builder()
.with_cipher_suites(TLS_SUPPORTED_CIPHERSUITES)
.with_safe_default_kx_groups()
let mut provider = rustls::crypto::ring::default_provider();
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is the most invasive part of this upgrade. In order to set the supported cipher suites to just the ones we want, we have create a crypto provider separately from the provider.

Also, the AllowAnyAnonymousOrAuthenticatedClient has been removed and replaced with client/server verifier builder methods.

Self(roots.into())
Self {
roots: roots.into(),
supported: rustls::crypto::ring::default_provider().signature_verification_algorithms,
Copy link
Collaborator Author

@sfleen sfleen Dec 4, 2024

Choose a reason for hiding this comment

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

This change I'm not entirely confident in. The cert verification methods below now take a list of supported algorithms instead of implicitly using the default, and this was the only reasonable way I was able to get the default list that the WebPkiServerVerifier implementation we copied was using.

This comment was marked as resolved.

cipher_suites: vec![CipherSuite::TLS_NULL_WITH_NULL_NULL],
compression_methods: vec![Compression::Null],
extensions: vec![ClientExtension::make_sni(sni.borrow())],
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The ClientExtension::make_sni was made private (these aren't part of the rustls public API), which is the motivator behind the changes in this file.

The purpose of this function is to generate a ClientHello message for tests, and in my playing around I wasn't able to find a more ergonomic way of generating one outside of this. I'm definitely open to ideas so we don't have to rely on internal rustls types for this.

@sfleen sfleen marked this pull request as ready for review December 4, 2024 17:00
@sfleen sfleen requested a review from a team as a code owner December 4, 2024 17:00
@olix0r olix0r self-assigned this Dec 4, 2024
@sfleen sfleen force-pushed the rustls branch 2 times, most recently from cc5ff36 to 587e28f Compare December 4, 2024 20:29
Copy link
Collaborator

@cratelyn cratelyn left a comment

Choose a reason for hiding this comment

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

this looks good to me! great work.

as a small aside, i hadn't ever thought to try dependency.workspace = true syntax before. that's nice. 🙂

Cargo.lock Outdated Show resolved Hide resolved
This bumps rustls itself from 0.21 to 0.23, which comes with a few breaking API changes. Most of these are limited to types being moved or renamed, or how the certificate verifiers are constructed.

Signed-off-by: Scott Fleener <[email protected]>
Copy link

codecov bot commented Dec 6, 2024

Codecov Report

Attention: Patch coverage is 88.37209% with 5 lines in your changes missing coverage. Please review.

Project coverage is 66.80%. Comparing base (96124bc) to head (68af107).
Report is 650 commits behind head on main.

Files with missing lines Patch % Lines
linkerd/app/outbound/src/tls/logical/tests.rs 84.61% 2 Missing ⚠️
linkerd/meshtls/rustls/src/creds/verify.rs 77.77% 2 Missing ⚠️
linkerd/meshtls/rustls/src/creds/store.rs 90.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3419      +/-   ##
==========================================
- Coverage   67.68%   66.80%   -0.88%     
==========================================
  Files         332      388      +56     
  Lines       15158    18139    +2981     
==========================================
+ Hits        10259    12118    +1859     
- Misses       4899     6021    +1122     
Files with missing lines Coverage Δ
linkerd/meshtls/rustls/src/client.rs 63.26% <100.00%> (ø)
linkerd/meshtls/rustls/src/creds.rs 83.33% <100.00%> (+2.25%) ⬆️
linkerd/meshtls/rustls/src/creds/receiver.rs 54.54% <ø> (ø)
linkerd/meshtls/rustls/src/server.rs 83.33% <100.00%> (+3.03%) ⬆️
linkerd/meshtls/rustls/src/creds/store.rs 90.62% <90.00%> (-1.80%) ⬇️
linkerd/app/outbound/src/tls/logical/tests.rs 93.33% <84.61%> (ø)
linkerd/meshtls/rustls/src/creds/verify.rs 80.00% <77.77%> (-7.50%) ⬇️

... and 162 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 24dc5d8...68af107. Read the comment docs.

linkerd/meshtls/rustls/src/creds.rs Outdated Show resolved Hide resolved
linkerd/meshtls/rustls/src/creds/store.rs Outdated Show resolved Hide resolved
Self(roots.into())
Self {
roots: roots.into(),
supported: rustls::crypto::ring::default_provider().signature_verification_algorithms,

This comment was marked as resolved.

linkerd/meshtls/rustls/src/creds/verify.rs Show resolved Hide resolved
This bumps rustls itself from 0.21 to 0.23, which comes with a few breaking API changes. Most of these are limited to types being moved or renamed, or how the certificate verifiers are constructed.

Signed-off-by: Scott Fleener <[email protected]>
Signed-off-by: Scott Fleener <[email protected]>
Copy link
Member

@olix0r olix0r left a comment

Choose a reason for hiding this comment

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

Thanks for making the requested changes. Something is still amiss with the Cargo.lock, though. To fix this, I would probably run something akin to git co origin/main -- Cargo.lock && cargo check. There's probably something funky in your dev setup that is causing gratuitous lock modification?

This seems to have been causing build/fetch errors in CI.

Signed-off-by: Scott Fleener <[email protected]>
@sfleen
Copy link
Collaborator Author

sfleen commented Dec 11, 2024

I've fixed the Cargo.lock, best as I can figure RA in vscode was clobbering lockfile changes for some reason.

@olix0r
Copy link
Member

olix0r commented Dec 11, 2024

Good work, @sfleen!

@sfleen sfleen enabled auto-merge (squash) December 11, 2024 17:23
@sfleen sfleen merged commit bb6e9b7 into linkerd:main Dec 11, 2024
19 checks passed
@cratelyn
Copy link
Collaborator

nice job, @sfleen!

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.

3 participants