rustup: `rustup install` behind a corporate proxy fails with TLS handshake eof
Verification
- I searched for recent similar issues at https://github.com/rust-lang/rustup/issues?q=is%3Aissue+is%3Aopen%2Cclosed and found no duplicates.
- I am on the latest version of Rustup according to https://github.com/rust-lang/rustup/tags and am still able to reproduce my issue.
Problem
When running rustup behind a corporate proxy (without RUSTUP_USE_CURL=1) this error is produced:
❯ https_proxy=http://our.corporate.proxy:8080 rustup -v install beta
debug: read metadata version: '12'
debug: installing toolchain 'beta-x86_64-unknown-linux-gnu'
debug: toolchain directory: '/home/user/.rustup/toolchains/beta-x86_64-unknown-linux-gnu'
info: syncing channel updates for 'beta-x86_64-unknown-linux-gnu'
debug: creating temp file: /home/user/.rustup/tmp/fr9g80t5bbku20gz_file
debug: downloading file from: 'https://static.rust-lang.org/dist/channel-rust-beta.toml.sha256'
debug: downloading with reqwest
debug: removing toolchain directory: '/home/user/.rustup/toolchains/beta-x86_64-unknown-linux-gnu'
error: could not download file from 'https://static.rust-lang.org/dist/channel-rust-beta.toml.sha256' to '/home/user/.rustup/tmp/fr9g80t5bbku20gz_file'
Caused by:
0: failed to make network request
1: error sending request for url (https://static.rust-lang.org/dist/channel-rust-beta.toml.sha256)
2: client error (Connect)
3: tls handshake eof
Dropping the protocol from the environment variable makes no difference. Adding RUSTUP_USE_CURL=1 fixes it, but apparently that’s deprecated.
One thing that may be relevant is that the corporate proxy is some kind of Fortinet Proxy and does not support the zstd encoding, although it doesn’t seem that the site tries to send it, even if advertised in Accept-Encoding header:
❯ https_proxy=http://our.corporate.proxy:8080 curl -H'Accept-Encoding: gzip, deflate, br, zstd' https://static.rust-lang.org/dist/channel-rust-beta.toml.sha256 -i
HTTP/1.1 200 Connection established
Proxy-Agent: Fortinet-Proxy/1.0
HTTP/1.1 200 OK
Connection: keep-alive
Content-Length: 89
x-amz-id-2: mXql6d23ngh+97LxTHAn6Xi9gwAKFzEF+Nav+Dt2XiM5MqhadLZhXUFx03fDBML0wVNr/ViEskSezEkcmUE25w==
x-amz-request-id: BTXNY0ZSHN2XNP9X
x-amz-storage-class: INTELLIGENT_TIERING
x-amz-server-side-encryption: AES256
x-amz-version-id: GU3vQbCUgbROXsRF6.3A_9u1QAIw8NjY
X-Served-By: cache-mxp6978-MXP
X-Cache: HIT
X-Cache-Hits: 1
X-Timer: S1745567961.974974,VS0,VE1
Last-Modified: Sun, 20 Apr 2025 02:19:51 GMT
ETag: "d3aaf2159800ee081e95612b2de0f7c3"
Content-Type: binary/octet-stream
Server: AmazonS3
Accept-Ranges: bytes
Date: Fri, 25 Apr 2025 07:59:20 GMT
Via: 1.1 varnish
Age: 5
dcf745f4f5daf2f9f5285edc4d2eb37f0a62297933c20c1727e15fa6edf5baa0 channel-rust-beta.toml
Steps
Output with RUSTUP_LOG=TRACE:
❯ RUSTUP_LOG=trace https_proxy=http://our.corporate.proxy:8080 rustup -v install beta
2025-04-25T08:04:14.263604Z DEBUG run_rustup:run_rustup_inner:main:set_globals: rustup::cli::common: read metadata version: '12' process=OsProcess(OsProcess { stderr_is_a_tty: true, stdout_is_a_tty: true }) console_filter=Handle { inner: (Weak), _s: PhantomData<fn(tracing_subscriber::registry::sharded::Registry)> } process=OsProcess(OsProcess { stderr_is_a_tty: true, stdout_is_a_tty: true }) console_filter=Handle { inner: (Weak), _s: PhantomData<fn(tracing_subscriber::registry::sharded::Registry)> } current_dir="/projects" process=OsProcess(OsProcess { stderr_is_a_tty: true, stdout_is_a_tty: true }) console_filter=Handle { inner: (Weak), _s: PhantomData<fn(tracing_subscriber::registry::sharded::Registry)> } args="[\"rustup\", \"-v\", \"install\", \"beta\"]" current_dir="/projects" quiet=false process=OsProcess(OsProcess { stderr_is_a_tty: true, stdout_is_a_tty: true })
2025-04-25T08:04:14.264681Z DEBUG run_rustup:run_rustup_inner:main:install:install: rustup::cli::common: installing toolchain 'beta-x86_64-unknown-linux-gnu' process=OsProcess(OsProcess { stderr_is_a_tty: true, stdout_is_a_tty: true }) console_filter=Handle { inner: (Weak), _s: PhantomData<fn(tracing_subscriber::registry::sharded::Registry)> } process=OsProcess(OsProcess { stderr_is_a_tty: true, stdout_is_a_tty: true }) console_filter=Handle { inner: (Weak), _s: PhantomData<fn(tracing_subscriber::registry::sharded::Registry)> } current_dir="/projects" process=OsProcess(OsProcess { stderr_is_a_tty: true, stdout_is_a_tty: true }) console_filter=Handle { inner: (Weak), _s: PhantomData<fn(tracing_subscriber::registry::sharded::Registry)> } args="[\"rustup\", \"-v\", \"install\", \"beta\"]"
2025-04-25T08:04:14.264696Z DEBUG run_rustup:run_rustup_inner:main:install:install: rustup::cli::common: toolchain directory: '/home/user/.rustup/toolchains/beta-x86_64-unknown-linux-gnu' process=OsProcess(OsProcess { stderr_is_a_tty: true, stdout_is_a_tty: true }) console_filter=Handle { inner: (Weak), _s: PhantomData<fn(tracing_subscriber::registry::sharded::Registry)> } process=OsProcess(OsProcess { stderr_is_a_tty: true, stdout_is_a_tty: true }) console_filter=Handle { inner: (Weak), _s: PhantomData<fn(tracing_subscriber::registry::sharded::Registry)> } current_dir="/projects" process=OsProcess(OsProcess { stderr_is_a_tty: true, stdout_is_a_tty: true }) console_filter=Handle { inner: (Weak), _s: PhantomData<fn(tracing_subscriber::registry::sharded::Registry)> } args="[\"rustup\", \"-v\", \"install\", \"beta\"]"
2025-04-25T08:04:14.264747Z INFO run_rustup:run_rustup_inner:main:install:install:update_from_dist: rustup::cli::common: syncing channel updates for 'beta-x86_64-unknown-linux-gnu' process=OsProcess(OsProcess { stderr_is_a_tty: true, stdout_is_a_tty: true }) console_filter=Handle { inner: (Weak), _s: PhantomData<fn(tracing_subscriber::registry::sharded::Registry)> } process=OsProcess(OsProcess { stderr_is_a_tty: true, stdout_is_a_tty: true }) console_filter=Handle { inner: (Weak), _s: PhantomData<fn(tracing_subscriber::registry::sharded::Registry)> } current_dir="/projects" process=OsProcess(OsProcess { stderr_is_a_tty: true, stdout_is_a_tty: true }) console_filter=Handle { inner: (Weak), _s: PhantomData<fn(tracing_subscriber::registry::sharded::Registry)> } args="[\"rustup\", \"-v\", \"install\", \"beta\"]" profile="Default" prefix="/home/user/.rustup/toolchains/beta-x86_64-unknown-linux-gnu"
2025-04-25T08:04:14.264819Z DEBUG run_rustup:run_rustup_inner:main:install:install:update_from_dist: rustup::cli::common: creating temp file: /home/user/.rustup/tmp/yabreatzi_qioeza_file process=OsProcess(OsProcess { stderr_is_a_tty: true, stdout_is_a_tty: true }) console_filter=Handle { inner: (Weak), _s: PhantomData<fn(tracing_subscriber::registry::sharded::Registry)> } process=OsProcess(OsProcess { stderr_is_a_tty: true, stdout_is_a_tty: true }) console_filter=Handle { inner: (Weak), _s: PhantomData<fn(tracing_subscriber::registry::sharded::Registry)> } current_dir="/projects" process=OsProcess(OsProcess { stderr_is_a_tty: true, stdout_is_a_tty: true }) console_filter=Handle { inner: (Weak), _s: PhantomData<fn(tracing_subscriber::registry::sharded::Registry)> } args="[\"rustup\", \"-v\", \"install\", \"beta\"]" profile="Default" prefix="/home/user/.rustup/toolchains/beta-x86_64-unknown-linux-gnu"
2025-04-25T08:04:14.264883Z DEBUG run_rustup:run_rustup_inner:main:install:install:update_from_dist: rustup::cli::common: downloading file from: 'https://static.rust-lang.org/dist/channel-rust-beta.toml.sha256' process=OsProcess(OsProcess { stderr_is_a_tty: true, stdout_is_a_tty: true }) console_filter=Handle { inner: (Weak), _s: PhantomData<fn(tracing_subscriber::registry::sharded::Registry)> } process=OsProcess(OsProcess { stderr_is_a_tty: true, stdout_is_a_tty: true }) console_filter=Handle { inner: (Weak), _s: PhantomData<fn(tracing_subscriber::registry::sharded::Registry)> } current_dir="/projects" process=OsProcess(OsProcess { stderr_is_a_tty: true, stdout_is_a_tty: true }) console_filter=Handle { inner: (Weak), _s: PhantomData<fn(tracing_subscriber::registry::sharded::Registry)> } args="[\"rustup\", \"-v\", \"install\", \"beta\"]" profile="Default" prefix="/home/user/.rustup/toolchains/beta-x86_64-unknown-linux-gnu"
2025-04-25T08:04:14.264894Z DEBUG run_rustup:run_rustup_inner:main:install:install:update_from_dist: rustup::cli::common: downloading with reqwest process=OsProcess(OsProcess { stderr_is_a_tty: true, stdout_is_a_tty: true }) console_filter=Handle { inner: (Weak), _s: PhantomData<fn(tracing_subscriber::registry::sharded::Registry)> } process=OsProcess(OsProcess { stderr_is_a_tty: true, stdout_is_a_tty: true }) console_filter=Handle { inner: (Weak), _s: PhantomData<fn(tracing_subscriber::registry::sharded::Registry)> } current_dir="/projects" process=OsProcess(OsProcess { stderr_is_a_tty: true, stdout_is_a_tty: true }) console_filter=Handle { inner: (Weak), _s: PhantomData<fn(tracing_subscriber::registry::sharded::Registry)> } args="[\"rustup\", \"-v\", \"install\", \"beta\"]" profile="Default" prefix="/home/user/.rustup/toolchains/beta-x86_64-unknown-linux-gnu"
2025-04-25T08:04:14.265034Z TRACE run_rustup:run_rustup_inner:main:install:install:update_from_dist: hyper_util::client::legacy::connect::http: Http::connect; scheme=Some("http"), host=Some("our.corporate.proxy"), port=Some(Port(8080)) process=OsProcess(OsProcess { stderr_is_a_tty: true, stdout_is_a_tty: true }) console_filter=Handle { inner: (Weak), _s: PhantomData<fn(tracing_subscriber::registry::sharded::Registry)> } process=OsProcess(OsProcess { stderr_is_a_tty: true, stdout_is_a_tty: true }) console_filter=Handle { inner: (Weak), _s: PhantomData<fn(tracing_subscriber::registry::sharded::Registry)> } current_dir="/projects" process=OsProcess(OsProcess { stderr_is_a_tty: true, stdout_is_a_tty: true }) console_filter=Handle { inner: (Weak), _s: PhantomData<fn(tracing_subscriber::registry::sharded::Registry)> } args="[\"rustup\", \"-v\", \"install\", \"beta\"]" profile="Default" prefix="/home/user/.rustup/toolchains/beta-x86_64-unknown-linux-gnu"
2025-04-25T08:04:14.287246Z DEBUG run_rustup:run_rustup_inner:main:install:install:update_from_dist: hyper_util::client::legacy::connect::http: connecting to 10.176.85.66:8080 process=OsProcess(OsProcess { stderr_is_a_tty: true, stdout_is_a_tty: true }) console_filter=Handle { inner: (Weak), _s: PhantomData<fn(tracing_subscriber::registry::sharded::Registry)> } process=OsProcess(OsProcess { stderr_is_a_tty: true, stdout_is_a_tty: true }) console_filter=Handle { inner: (Weak), _s: PhantomData<fn(tracing_subscriber::registry::sharded::Registry)> } current_dir="/projects" process=OsProcess(OsProcess { stderr_is_a_tty: true, stdout_is_a_tty: true }) console_filter=Handle { inner: (Weak), _s: PhantomData<fn(tracing_subscriber::registry::sharded::Registry)> } args="[\"rustup\", \"-v\", \"install\", \"beta\"]" profile="Default" prefix="/home/user/.rustup/toolchains/beta-x86_64-unknown-linux-gnu"
2025-04-25T08:04:14.292956Z DEBUG run_rustup:run_rustup_inner:main:install:install:update_from_dist: hyper_util::client::legacy::connect::http: connected to 10.176.85.66:8080 process=OsProcess(OsProcess { stderr_is_a_tty: true, stdout_is_a_tty: true }) console_filter=Handle { inner: (Weak), _s: PhantomData<fn(tracing_subscriber::registry::sharded::Registry)> } process=OsProcess(OsProcess { stderr_is_a_tty: true, stdout_is_a_tty: true }) console_filter=Handle { inner: (Weak), _s: PhantomData<fn(tracing_subscriber::registry::sharded::Registry)> } current_dir="/projects" process=OsProcess(OsProcess { stderr_is_a_tty: true, stdout_is_a_tty: true }) console_filter=Handle { inner: (Weak), _s: PhantomData<fn(tracing_subscriber::registry::sharded::Registry)> } args="[\"rustup\", \"-v\", \"install\", \"beta\"]" profile="Default" prefix="/home/user/.rustup/toolchains/beta-x86_64-unknown-linux-gnu"
2025-04-25T08:04:14.321579Z DEBUG run_rustup:run_rustup_inner:main:install:install:update_from_dist: rustup::cli::common: removing toolchain directory: '/home/user/.rustup/toolchains/beta-x86_64-unknown-linux-gnu' process=OsProcess(OsProcess { stderr_is_a_tty: true, stdout_is_a_tty: true }) console_filter=Handle { inner: (Weak), _s: PhantomData<fn(tracing_subscriber::registry::sharded::Registry)> } process=OsProcess(OsProcess { stderr_is_a_tty: true, stdout_is_a_tty: true }) console_filter=Handle { inner: (Weak), _s: PhantomData<fn(tracing_subscriber::registry::sharded::Registry)> } current_dir="/projects" process=OsProcess(OsProcess { stderr_is_a_tty: true, stdout_is_a_tty: true }) console_filter=Handle { inner: (Weak), _s: PhantomData<fn(tracing_subscriber::registry::sharded::Registry)> } args="[\"rustup\", \"-v\", \"install\", \"beta\"]" profile="Default" prefix="/home/user/.rustup/toolchains/beta-x86_64-unknown-linux-gnu"
2025-04-25T08:04:14.321640Z TRACE run_rustup:run_rustup_inner:main:install:install:update_from_dist: rustup::dist: error=could not download file from 'https://static.rust-lang.org/dist/channel-rust-beta.toml.sha256' to '/home/user/.rustup/tmp/yabreatzi_qioeza_file' process=OsProcess(OsProcess { stderr_is_a_tty: true, stdout_is_a_tty: true }) console_filter=Handle { inner: (Weak), _s: PhantomData<fn(tracing_subscriber::registry::sharded::Registry)> } process=OsProcess(OsProcess { stderr_is_a_tty: true, stdout_is_a_tty: true }) console_filter=Handle { inner: (Weak), _s: PhantomData<fn(tracing_subscriber::registry::sharded::Registry)> } current_dir="/projects" process=OsProcess(OsProcess { stderr_is_a_tty: true, stdout_is_a_tty: true }) console_filter=Handle { inner: (Weak), _s: PhantomData<fn(tracing_subscriber::registry::sharded::Registry)> } args="[\"rustup\", \"-v\", \"install\", \"beta\"]" profile="Default" prefix="/home/user/.rustup/toolchains/beta-x86_64-unknown-linux-gnu"
2025-04-25T08:04:14.321680Z TRACE run_rustup:run_rustup_inner:main:install:install: rustup::install: error=could not download file from 'https://static.rust-lang.org/dist/channel-rust-beta.toml.sha256' to '/home/user/.rustup/tmp/yabreatzi_qioeza_file' process=OsProcess(OsProcess { stderr_is_a_tty: true, stdout_is_a_tty: true }) console_filter=Handle { inner: (Weak), _s: PhantomData<fn(tracing_subscriber::registry::sharded::Registry)> } process=OsProcess(OsProcess { stderr_is_a_tty: true, stdout_is_a_tty: true }) console_filter=Handle { inner: (Weak), _s: PhantomData<fn(tracing_subscriber::registry::sharded::Registry)> } current_dir="/projects" process=OsProcess(OsProcess { stderr_is_a_tty: true, stdout_is_a_tty: true }) console_filter=Handle { inner: (Weak), _s: PhantomData<fn(tracing_subscriber::registry::sharded::Registry)> } args="[\"rustup\", \"-v\", \"install\", \"beta\"]"
2025-04-25T08:04:14.321712Z TRACE run_rustup:run_rustup_inner:main:install: rustup::toolchain::distributable: error=could not download file from 'https://static.rust-lang.org/dist/channel-rust-beta.toml.sha256' to '/home/user/.rustup/tmp/yabreatzi_qioeza_file' process=OsProcess(OsProcess { stderr_is_a_tty: true, stdout_is_a_tty: true }) console_filter=Handle { inner: (Weak), _s: PhantomData<fn(tracing_subscriber::registry::sharded::Registry)> } process=OsProcess(OsProcess { stderr_is_a_tty: true, stdout_is_a_tty: true }) console_filter=Handle { inner: (Weak), _s: PhantomData<fn(tracing_subscriber::registry::sharded::Registry)> } current_dir="/projects" process=OsProcess(OsProcess { stderr_is_a_tty: true, stdout_is_a_tty: true }) console_filter=Handle { inner: (Weak), _s: PhantomData<fn(tracing_subscriber::registry::sharded::Registry)> } args="[\"rustup\", \"-v\", \"install\", \"beta\"]"
2025-04-25T08:04:14.321751Z TRACE run_rustup:run_rustup_inner: rustup_init: error=could not download file from 'https://static.rust-lang.org/dist/channel-rust-beta.toml.sha256' to '/home/user/.rustup/tmp/yabreatzi_qioeza_file' process=OsProcess(OsProcess { stderr_is_a_tty: true, stdout_is_a_tty: true }) console_filter=Handle { inner: (Weak), _s: PhantomData<fn(tracing_subscriber::registry::sharded::Registry)> } process=OsProcess(OsProcess { stderr_is_a_tty: true, stdout_is_a_tty: true }) console_filter=Handle { inner: (Weak), _s: PhantomData<fn(tracing_subscriber::registry::sharded::Registry)> }
2025-04-25T08:04:14.321788Z ERROR rustup::cli::common: could not download file from 'https://static.rust-lang.org/dist/channel-rust-beta.toml.sha256' to '/home/user/.rustup/tmp/yabreatzi_qioeza_file'
Caused by:
0: failed to make network request
1: error sending request for url (https://static.rust-lang.org/dist/channel-rust-beta.toml.sha256)
2: client error (Connect)
3: tls handshake eof
Possible Solution(s)
No response
Notes
No response
Rustup version
❯ rustup --version
rustup 1.28.1 (f9edccde0 2025-03-05)
info: This is the version for the rustup toolchain manager, not the rustc compiler.
info: The currently active `rustc` version is `rustc 1.88.0-nightly (a15cce269 2025-04-17)`
Installed toolchains
❯ rustup show
Default host: x86_64-unknown-linux-gnu
rustup home: /home/user/.rustup
installed toolchains
--------------------
stable-x86_64-unknown-linux-gnu
nightly-x86_64-unknown-linux-gnu (active, default)
active toolchain
----------------
name: nightly-x86_64-unknown-linux-gnu
active because: it's the default toolchain
installed targets:
x86_64-unknown-linux-gnu
OS version
❯ cat /etc/*release
NAME="Red Hat Enterprise Linux"
VERSION="9.5 (Plow)"
ID="rhel"
ID_LIKE="fedora"
VERSION_ID="9.5"
PLATFORM_ID="platform:el9"
PRETTY_NAME="Red Hat Enterprise Linux 9.5 (Plow)"
ANSI_COLOR="0;31"
LOGO="fedora-logo-icon"
CPE_NAME="cpe:/o:redhat:enterprise_linux:9::baseos"
HOME_URL="https://www.redhat.com/"
DOCUMENTATION_URL="https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/9"
BUG_REPORT_URL="https://issues.redhat.com/"
REDHAT_BUGZILLA_PRODUCT="Red Hat Enterprise Linux 9"
REDHAT_BUGZILLA_PRODUCT_VERSION=9.5
REDHAT_SUPPORT_PRODUCT="Red Hat Enterprise Linux"
REDHAT_SUPPORT_PRODUCT_VERSION="9.5"
Red Hat Enterprise Linux release 9.5 (Plow)
Red Hat Enterprise Linux release 9.5 (Plow)
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 52 (30 by maintainers)
Really greatest and warmest thanks to you all for getting so thoroughly involved. Was some crazy investigating but now that we’ve gotten to the bottom of this issue, it’s easy to fix on my side so the issue can be addressed later, whatever the fix may be. Diagnostics were already but could definitely be further improved in the long-term, but that is indeed a never ending battle.
Thanks!
Confirmed that works locally for me.
Before fix
After fix
tls handshake eoforiginates from tokio-rustls, and signifies the connection was closed at the TCP level unexpectedly during the TLS handshake. Unfortunately I think that means there are no avenues for further debugging at the client end.Seems fair. It looks like this is a pretty rare platform-specific issue anyway, and we have some mitigations/improvements already in place.
For this, cargo uses the host openssl installation, which will have been customised by your distribution to know the most accurate location. That is good. But that cargo sets the environment variables at all is a mistake.
No. The
SSL_CERT_FILEandSSL_CERT_DIRenvironment variables are overrides, and should prevent any other locations being consulted.Why is that? Does it point to a directory full of
openssl rehash-style certificate files?Could you run this?
And then inspect the file and directory it prints?
FWIW on ubuntu for me this gives:
The file
/usr/lib/ssl/cert.pem:The directory
/usr/lib/ssl/certs:Really appreciate your patience as we get to the bottom of this!
This line also caught my attention:
rustup:
my binary:
I also tried this diff, which didn’t change anything:
No difference