Cargo curl parameters

Hi. I use linux subsystem for windows(WSL) - ubuntu 18.04

cargo build
error: failed to download from `https://crates.io/api/v1/crates/rand/0.3.23/download`

Caused by:
  [60] Peer certificate cannot be authenticated with given CA certificates (server certificate verification failed. CAfile: /etc/ssl/certs/ca-certificates.crt CRLfile: none)

Error [60] defined in curl
When specifying the -k option in the file ~/.curl, the curl works.
How to specify options for cargo?

I don't think Cargo has an option to disable security. Instead, try installing up-to-date root certificates to secure the connection:

sudo apt-get update
sudo apt-get install ca-certificates

If you're on a network which intentionally intercepts TLS (some companies do that to monitor their employees, some questionable antivirus programs do too), then you'll need to install the certificate used by your MITM proxy, or use some kind of VPN to bypass it.

apt-get install ca-certificates
Reading package lists... Done
Building dependency tree
Reading state information... Done
ca-certificates is already the newest version (20180409).

Domain proxy (Websence) substitutes the certificate.
I imported a websenke.cer and trusted domain CA from a windows host to /usr/share/ca-certificates/extra/websence.crt

 WSL:
cp /mnt/c/<windows path>websence.cer /usr/share/ca-certificates/extra/websence.crt
echo extra/websence.crt >>  /etc/ca-certificates.conf.
update-ca-certificates

It works.

1 Like