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

Re-add rustls support (enabled by setting RUSTUP_USE_RUSTLS) #2517

Merged
merged 3 commits into from
Dec 12, 2020

Conversation

est31
Copy link
Member

@est31 est31 commented Oct 9, 2020

rustls is seen as mature enough for curl to depend on it optionally,
and it recently has had an audit.

This commit adds back rustls support removed by 86bb185

You can opt into using rustls by setting the RUSTUP_USE_RUSTLS env variable.

Blockers:

TODO:

  • Default should remain curl for now, but allow testing of rustls e.g. via RUSTUP_USE_RUSTLS

Fixes #568

@est31
Copy link
Member Author

est31 commented Oct 9, 2020

I haven't added ability to use the native TLS stack via an env var, because reqwest lacks support for that (it will just always prefer the native TLS stack over rustls), and because users wanting to use openssl already have an option with the RUSTUP_USE_CURL env var.

@est31
Copy link
Member Author

est31 commented Oct 9, 2020

If you want env var configurability, please leave a comment, because it'll require reqwest changes.

@est31
Copy link
Member Author

est31 commented Oct 10, 2020

Mhh seems that env var configurability was easier than thought.

@est31
Copy link
Member Author

est31 commented Oct 11, 2020

Anyone know what the cause of this can be? It only occurs on mac OS:

error[E0463]: can't find crate for `serde_derive`
   --> /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/serde-1.0.115/src/lib.rs:285:1
    |
285 | extern crate serde_derive;
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^ can't find crate

error: aborting due to previous error

@est31 est31 marked this pull request as draft October 11, 2020 09:46
@est31 est31 force-pushed the rustls branch 3 times, most recently from 2b84c6b to a3b4b9e Compare October 11, 2020 13:38
@est31 est31 marked this pull request as ready for review October 11, 2020 14:03
@est31
Copy link
Member Author

est31 commented Oct 11, 2020

Apparently doing cargo update -p serde fixes the issue, no idea why

@est31
Copy link
Member Author

est31 commented Oct 11, 2020

Oh the mac OS bug seems to be addressed by @ehuss in #2513

@est31
Copy link
Member Author

est31 commented Oct 11, 2020

Alright as the other PR has a proper fix for the issue I've removed the local hack and leave the fix for @ehuss 's PR.

@kinnison
Copy link
Contributor

Thank you for this work - have you confirmed that rustls will use the system certificate store properly? One issue which people using rustup behind corporate proxies complain about is that they have https problems. Making it harder for them to fix in a system-standard way would be bad.

@est31
Copy link
Member Author

est31 commented Oct 16, 2020

Currently the rustls mode of reqwest uses the mozilla provided certificate store through the webpki-roots crate. One would have to use the rustls-native-certs crate instead. This requires reqwest changes I think.

Note there are cons of using native certificates as well. rustup's entire security model depends on https only (cc #2028). But I guess that's a separate issue from rustls adoption. If rustup used curl previously, it can now use rustls.

@kinnison
Copy link
Contributor

How does webpki-roots work wrt. updates? Do we have to release a new rustup build to get them?

@est31
Copy link
Member Author

est31 commented Oct 16, 2020

@kinnison yes, an update would be needed to get newer root certificates. I think there is no way around a mode for using the OS certificate store.

@est31
Copy link
Member Author

est31 commented Oct 16, 2020

@kinnison
Copy link
Contributor

Hmm, I think I need to spend more time thinking on this than I have right now. Thank you for that link though.

@rbtcollins what do you feel about this PR?

@est31
Copy link
Member Author

est31 commented Oct 16, 2020

Ok this should be the reqwest change: seanmonstar/reqwest#1058

Ignore the rustls-native-roots PR. It won't be required to switch rustup to rustls.

I've updated this PR to use my reqwest fork so that users can test this PR.

@kinnison do you know the users with a proxy setup that relies on OS native certificates? Could you maybe ask them to try this PR whether there is any regression for them?

Should rustls maybe not be enabled by default for now to enable a testing phase?

@rbtcollins
Copy link
Contributor

rbtcollins commented Oct 16, 2020 via email

@est31 est31 changed the title Re-add rustls support and enable it by default Re-add rustls support (enabled by setting RUSTUP_USE_RUSTLS) Oct 16, 2020
@est31 est31 force-pushed the rustls branch 2 times, most recently from 7ed5cdf to 6d0fc25 Compare October 17, 2020 17:51
@kinnison
Copy link
Contributor

This branch is currently in conflict with Cargo.toml. Could you rebase, check things are still clean, and then ping me for re-review?

@est31
Copy link
Member Author

est31 commented Nov 17, 2020

@kinnison I've rebased it but the FIXME's are still unfixed, so CI will fail, and it will still use a forked version of upstream reqwest :).

@kinnison
Copy link
Contributor

@est31 Thanks, it's okay I just wanted to be sure the diffs were clean so I can think about things. Obviously I agree it's not mergeable yet :D

@kinnison kinnison marked this pull request as draft November 17, 2020 16:21
@est31 est31 force-pushed the rustls branch 3 times, most recently from f5f95d8 to 66ecdc3 Compare November 20, 2020 05:53
@est31 est31 marked this pull request as ready for review November 20, 2020 05:53
@est31
Copy link
Member Author

est31 commented Nov 20, 2020

All the blockers are resolved. Ready for review now @kinnison !

Copy link
Contributor

@kinnison kinnison left a comment

Choose a reason for hiding this comment

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

I believe this is okay, and default to "not rustls" @rbtcollins How do you feel about this? It's easily backed out if it proves out as bad, but it shouldn't be harmful to include this as optional support. I'm not interested in documenting this publically yet though.

@rbtcollins
Copy link
Contributor

rbtcollins commented Nov 22, 2020 via email

@est31
Copy link
Member Author

est31 commented Nov 24, 2020

@kinnison why do you not want to document it publicly? I think it should be so that users can be asked to try it out as the intention is to make it default some point in the future.

@kinnison
Copy link
Contributor

@est31 Sorry, I was perhaps not clear. My intent would be that after 1.23 we merge this. Then we can seek targetted feedback by asking for people to build master and try it. When we're confident there's no reason to exclude it from a release we can release with it in, but disabled. At that point we seek further engagement with the feature, and document it in our book.

Given we're still not comfortable disabling CURL support I'm really going to be dealing with this cautiously.

@est31
Copy link
Member Author

est31 commented Nov 25, 2020

Oh so that's your plan. Note that it's entirely opt-in. I'm not sure what could go wrong if you don't enable it (the PR makes it opt-in at runtime), so I'm not sure something is gained by that proposal. But shrug. Better it gets in later than never :).

@est31
Copy link
Member Author

est31 commented Nov 26, 2020

Oh hmmmm .... the new release is in staging already. Yeah then it's better to wait for the one after that. https://internals.rust-lang.org/t/new-rustup-release-staged-and-needing-testers/13446

rustls is seen as mature enough for curl to depend on it optionally,
and it recently has had an audit.

This commit adds back rustls support removed by 86bb185
and enables it by default.

You can opt out of rustls use by setting the RUSTUP_AVOID_RUSTLS env
variable.
Defaulting to native-tls so that users can try out the rustls mode
before it's turned on by default.
@est31
Copy link
Member Author

est31 commented Nov 27, 2020

Rebased onto the 1.23.0 release

@kinnison kinnison added this to the 1.24.0 milestone Nov 27, 2020
@kinnison
Copy link
Contributor

I think it's time to take this on and see how we do. @est31 it would be good if you would switch your local use of rustup to use this feature so we can check it more thoroughly. I shall endeavour to do so as well.

@kinnison kinnison merged commit c63e321 into rust-lang:master Dec 12, 2020
@est31
Copy link
Member Author

est31 commented Dec 12, 2020

@est31 it would be good if you would switch your local use of rustup to use this feature so we can check it more thoroughly.

Good idea! I assume you install rustup locally by doing cargo build --release && cp target/release/rustup-init ~/.cargo/bin/rustup?

@kinnison
Copy link
Contributor

You can do cargo run -- --no-modify-path -y or cargo run --release -- --no-modify-path -y if you want to install the build.

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.

Implement optional support for rustls
3 participants