rust-lang / rust-lang/cargo

cargo: [60] SSL peer certificate or SSH remote key was not OK (SSL certificate problem: unable to get local issuer certificate)

Open
#10,751 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-networking C-bug S-triage
Dominant language
Rust
Stars
15.5k
Forks
3k
Avg merge
23h 30m
Merged PRs (30d)
51

Description

Problem

Build System: x86_64-unknown-linux-gcc
Target/Host: mips64-openwrt-linux-musl
OpenWrt uses OpenSSL 1.1.1o which posed issues with rust 1.61.0, although seems to be fixed from commit 420c970cb1edccbf60ff2aeb51ca01e2300b09ef

cd /media/data/openwrt/build_dir/target-mips64_octeonplus_64_musl/float_test-0.8.5 && RUSTFLAGS=" -C linker=/media/data/openwrt/staging_dir/toolchain-mips64_octeonplus_64_gcc-11.3.0_musl/bin/mips64-openwrt-linux-musl-gcc -C ar=/media/data/openwrt/staging_dir/toolchain-mips64_octeonplus_64_gcc-11.3.0_musl/bin/mips64-openwrt-linux-musl-gcc-ar -C target-cpu=octeon+" CARGO_HOME="/media/data/openwrt/staging_dir/host" cargo build -v --release --target mips64-openwrt-linux-musl
error: failed to download from `https://crates.io/api/v1/crates/crossterm/0.22.1/download`

Caused by:
  [60] SSL peer certificate or SSH remote key was not OK (SSL certificate problem: unable to get local issuer certificate)

Running strace

cd /media/data/openwrt/build_dir/target-mips64_octeonplus_64_musl/float_test-0.8.5 && RUSTFLAGS=" -C linker=/media/data/openwrt/staging_dir/toolchain-mips64_octeonplus_64_gcc-11.3.0_musl/bin/mips64-openwrt-linux-musl-gcc -C ar=/media/data/openwrt/staging_dir/toolchain-mips64_octeonplus_64_gcc-11.3.0_musl/bin/mips64-openwrt-linux-musl-gcc-ar -C target-cpu=octeon+" CARGO_HOME="/media/data/openwrt/staging_dir/host" RUST_BACKTRACE=full strace -e openat cargo build -v --release --target mips64-openwrt-linux-musl 2>&1 | grep pem
openat(AT_FDCWD, "/media/data/openwrt/staging_dir/host/etc/ssl/cert.pem", O_RDONLY) = 3

Unfortunately, it doesn't give me any more information than this.

Steps

Build rust-lang from source from commit 420c970cb1edccbf60ff2aeb51ca01e2300b09ef into OpenWrt
Build HOST-build toolchain (x86_64-unknown-linux-gcc), build mips64-openwrt-linux-musl, attempt to compile test package (which worked previously under 1.60).

Possible Solution(s)

Since OpenSSL 1.1.1o caused issues under rust, is it possible it is causing issues under cargo?

Notes

OpenWrt uses a fakeroot and MUSL toolchains to cross-compile into various target arches.

Version
azureuser@wrtbuilder:~/openwrt/staging_dir/host/bin$ ./cargo version --verbose
cargo 1.63.0-nightly
release: 1.63.0-nightly
host: x86_64-unknown-linux-gnu
libgit2: 1.4.2 (sys:0.14.2 vendored)
libcurl: 7.83.1-DEV (sys:0.4.55+curl-7.83.1 vendored ssl:LibreSSL/3.4.2)
os: Ubuntu 20.04 (focal) [64-bit]

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the failure with the shown cargo build command and the crates.io download, then inspect the certificate-loading path around /media/data/openwrt/staging_dir/host/etc/ssl/cert.pem. Compare the Rust 1.60 behavior with the 1.63.0-nightly build and its vendored LibreSSL/libcurl versions; done means cross-compiled Cargo can verify the registry certificate successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
build-system, networking, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.