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

Use aws-lc-rs instead of ring for TLS #4734

Conversation

kcon-stackav
Copy link

Summary

This PR switches the TLS backend used by reqwest from ring to aws-lc to support more SSL certificate signature algorithms (especially P521 algorithms which aren't yet supported by ring: briansmith/ring#1631).

Fixes #4534

Test Plan

I used uv pip install to try installing a package from a private PyPI server whose SSL certificate was signed using the ECDSA SHA-512 certificate signature algorithm and, using the Rust debugger, observed that uv did not fail to install the package due to not supporting the ECDSA SHA-512 certificate signature algorithm.

@kcon-stackav kcon-stackav changed the title Explore using aws-lc-rs instead of ring for TLS Use aws-lc-rs instead of ring for TLS Jul 2, 2024
@zanieb zanieb self-assigned this Jul 2, 2024
@zanieb zanieb added the network Network connectivity e.g. proxies, DNS, and SSL label Jul 2, 2024
@zanieb
Copy link
Member

zanieb commented Jul 2, 2024

Thanks for the pull request!

@zanieb
Copy link
Member

zanieb commented Jul 2, 2024

This Windows failure also looks somewhat problematic (see aws/aws-lc#1477 and example fix)

@kcon-stackav kcon-stackav force-pushed the kcon-stackav/use-aws-lc-instead-of-ring branch from 7f091b3 to 34852fe Compare July 2, 2024 22:07
@kcon-stackav kcon-stackav force-pushed the kcon-stackav/use-aws-lc-instead-of-ring branch from 34852fe to 7fdb31c Compare July 2, 2024 22:20
Comment on lines +85 to +86
- name: "Install nasm"
uses: ilammy/setup-nasm@v1
Copy link
Author

Choose a reason for hiding this comment

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

@zanieb I'm not very familiar with maturin, do you think installing NASM is needed for the build-binaries Windows job too?

windows:
if: ${{ !contains(github.event.pull_request.labels.*.name, 'no-build') }}
runs-on: windows-latest
strategy:
matrix:
platform:
- target: x86_64-pc-windows-msvc
arch: x64
- target: i686-pc-windows-msvc
arch: x86

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

maturin calls cargo build, so they same rules should apply whether it's maturin or not.

.github/workflows/ci.yml Show resolved Hide resolved
@kcon-stackav kcon-stackav marked this pull request as ready for review July 2, 2024 22:38
@@ -216,6 +218,9 @@ jobs:
run: |
Copy-Item -Path "${{ github.workspace }}" -Destination "${{ env.DEV_DRIVE }}/uv" -Recurse

- name: "Install nasm"
uses: ilammy/setup-nasm@v1
Copy link
Member

Choose a reason for hiding this comment

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

Note to self we should audit this action and consider just implementing it ourself if the install is straightforward

Copy link
Collaborator

Choose a reason for hiding this comment

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

Comment on lines +142 to +144
if aws_lc_rs::default_provider().install_default().is_err() {
warn_user_once!("Failed to install aws_lc_rs as the default TLS provider.");
}
Copy link
Member

Choose a reason for hiding this comment

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

It looks like the error attached to the result is just Self and has no information, right?

Copy link
Author

Choose a reason for hiding this comment

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

Yes I understand the error holds the CryptoProvider that was previously installed as the default in that case.

Copy link
Member

Choose a reason for hiding this comment

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

I guess we could capture it to say what we're using instead but it doesn't seem critical.

Copy link
Author

Choose a reason for hiding this comment

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

Ah yeah I thought about doing that but I wasn't sure the CryptoProvider had a nice human-readable name field we could use: https://docs.rs/rustls/latest/rustls/crypto/struct.CryptoProvider.html

@zanieb
Copy link
Member

zanieb commented Jul 10, 2024

Sorry this is lingering, I'm just not sure of the trade-offs here since it changes our release pipeline and hasn't been requested by many people.

@kcon-stackav
Copy link
Author

Sorry this is lingering, I'm just not sure of the trade-offs here since it changes our release pipeline and hasn't been requested by many people.

No worries, and feel free to close this PR if not enough people are wanting it since I learned that switching from ring to aws-lc-rs doesn't solve my particular problem after all (#4534 (comment)), but I believe #1339 should once it becomes available.

@zanieb zanieb added the needs-decision Undecided if this should be done label Jul 15, 2024
@zanieb
Copy link
Member

zanieb commented Jul 19, 2024

I think I'll close for now since this changes our build dependencies and there isn't a compelling reason to switch over at this time. Happy to reconsider in the future.

@zanieb zanieb closed this Jul 19, 2024
@rami3l
Copy link

rami3l commented Aug 1, 2024

@zanieb As a part of Rustup's plan for the v1.28.0 release cycle, I've migrated Rustup to aws-lc-rs in rust-lang/rustup#3898 for the very same reason (rust-lang/rustup#3820), and I've been contacting aws-lc's side, providing useful information to help address various issues regarding the cross compilation of this library. I'd love to share more experience with you when we're able to actually ship the build, if you're interested.

@zanieb
Copy link
Member

zanieb commented Aug 1, 2024

Thanks @rami3l, I appreciate the heads up and am definitely interested.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-decision Undecided if this should be done network Network connectivity e.g. proxies, DNS, and SSL
Projects
None yet
Development

Successfully merging this pull request may close these issues.

invalid peer certificate: BadSignature when installing package from private index using ECDSA SHA-512 SSL cert
5 participants