{"action":"created","issue":{"url":"https://api.github.com/repos/rust-lang/cargo/issues/976","labels_url":"https://api.github.com/repos/rust-lang/cargo/issues/976/labels{/name}","comments_url":"https://api.github.com/repos/rust-lang/cargo/issues/976/comments","events_url":"https://api.github.com/repos/rust-lang/cargo/issues/976/events","html_url":"https://github.com/rust-lang/cargo/issues/976","id":50028813,"number":976,"title":"Cannot get sources from https://crates.io as curl fails the certificate check","user":{"login":"Siosm","id":3374235,"avatar_url":"https://avatars.githubusercontent.com/u/3374235?v=3","gravatar_id":"","url":"https://api.github.com/users/Siosm","html_url":"https://github.com/Siosm","followers_url":"https://api.github.com/users/Siosm/followers","following_url":"https://api.github.com/users/Siosm/following{/other_user}","gists_url":"https://api.github.com/users/Siosm/gists{/gist_id}","starred_url":"https://api.github.com/users/Siosm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Siosm/subscriptions","organizations_url":"https://api.github.com/users/Siosm/orgs","repos_url":"https://api.github.com/users/Siosm/repos","events_url":"https://api.github.com/users/Siosm/events{/privacy}","received_events_url":"https://api.github.com/users/Siosm/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":29,"created_at":"2014-11-25T13:53:40Z","updated_at":"2015-07-05T03:08:48Z","closed_at":"2015-06-15T23:05:50Z","body":"Building any project with dependencies on crates.io, with the latest nightly, on Arch Linux, ends with this error:\r\n```\r\n$ cargo build --verbose\r\n    Updating registry `https://github.com/rust-lang/crates.io-index`\r\n Downloading pkg-config v0.0.1\r\nUnable to get packages from source\r\n\r\nCaused by:\r\n  Failed to download package `pkg-config v0.0.1` from https://crates.io/api/v1/crates/pkg-config/0.0.1/download\r\n\r\nCaused by:\r\n  Peer certificate cannot be authenticated with given CA certificates\r\n```\r\n\r\nSample Cargo.toml reproducing the issue:\r\n```\r\n$ cat Cargo.toml\r\n[package]\r\n\r\nname = \"nickel-demo\"\r\nversion = \"0.0.1\"\r\nauthors = [\"Timothée Ravier <tim@siosm.fr>\"]\r\n\r\n[dependencies.nickel]\r\n\r\ngit = \"https://github.com/nickel-org/nickel.rs.git\"\r\n```\r\n\r\nAnd version info:\r\n```\r\n$ rustc --version=verbose\r\nrustc 0.13.0-nightly (395901393 2014-11-24 00:46:30 +0000)\r\nbinary: rustc\r\ncommit-hash: 395901393c369c910a8ae36ace71402cb206d217\r\ncommit-date: 2014-11-24 00:46:30 +0000\r\nhost: x86_64-unknown-linux-gnu\r\nrelease: 0.13.0-nightly\r\n$ cargo --version\r\ncargo 0.0.1-pre-nightly (1bdfb25 2014-11-20 19:29:22 +0000)\r\n```\r\n\r\nUsing curl manually gives the following output:\r\n```\r\n$ curl -v https://crates.io/api/v1/crates/pkg-config/0.0.1/download\r\n* Hostname was NOT found in DNS cache\r\n*   Trying 107.20.211.76...\r\n* Connected to crates.io (107.20.211.76) port 443 (#0)\r\n* successfully set certificate verify locations:\r\n*   CAfile: /etc/ssl/certs/ca-certificates.crt\r\n  CApath: none\r\n* SSLv3, TLS handshake, Client hello (1):\r\n* SSLv3, TLS handshake, Server hello (2):\r\n* SSLv3, TLS handshake, CERT (11):\r\n* SSLv3, TLS handshake, Server key exchange (12):\r\n* SSLv3, TLS handshake, Server finished (14):\r\n* SSLv3, TLS handshake, Client key exchange (16):\r\n* SSLv3, TLS change cipher, Client hello (1):\r\n* SSLv3, TLS handshake, Finished (20):\r\n* SSLv3, TLS change cipher, Client hello (1):\r\n* SSLv3, TLS handshake, Finished (20):\r\n* SSL connection using TLSv1.2 / ECDHE-RSA-AES128-GCM-SHA256\r\n* Server certificate:\r\n*        subject: OU=GT87339749; OU=See www.rapidssl.com/resources/cps (c)14; OU=Domain Control Validated - RapidSSL(R); CN=crates.io\r\n*        start date: 2014-11-06 11:11:23 GMT\r\n*        expire date: 2015-11-09 14:30:14 GMT\r\n*        subjectAltName: crates.io matched\r\n*        issuer: C=US; O=GeoTrust Inc.; CN=RapidSSL SHA256 CA - G3\r\n*        SSL certificate verify ok.\r\n> GET /api/v1/crates/pkg-config/0.0.1/download HTTP/1.1\r\n> User-Agent: curl/7.39.0\r\n> Host: crates.io\r\n> Accept: */*\r\n> \r\n< HTTP/1.1 302 Found\r\n< Connection: keep-alive\r\n< Server: nginx\r\n< Date: Tue, 25 Nov 2014 13:46:14 GMT\r\n< Transfer-Encoding: chunked\r\n< Set-Cookie: cargo_session=--3c156d7a3629aa08a1a0d538832f99ea30835cc8; HttpOnly; Secure; Path=/\r\n< Location: https://crates-io.s3-us-west-1.amazonaws.com/crates/pkg-config/pkg-config-0.0.1.crate\r\n< Strict-Transport-Security: max-age=31536000\r\n< Via: 1.1 vegur\r\n< \r\n* Connection #0 to host crates.io left intact\r\n```\r\n\r\nAnd tracing cargo build with strace gives:\r\n```\r\n$ strace -f -e trace=file cargo build --verbose\r\n(...)\r\n Downloading pkg-config v0.0.1\r\nstat(\"/home/tim/.cargo/registry/cache/github.com-1ecc6299db9ec823\", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0\r\ngetcwd(\"/home/tim/projects/perso/rust/nickel-demo\", 2048) = 42\r\nstat(\"/home/tim/projects/perso/rust/nickel-demo/.cargo/config\", 0x7fffb1eba210) = -1 ENOENT (No such file or directory)\r\nstat(\"/home/tim/projects/perso/rust/.cargo/config\", 0x7fffb1eba210) = -1 ENOENT (No such file or directory)\r\nstat(\"/home/tim/projects/perso/.cargo/config\", 0x7fffb1eba210) = -1 ENOENT (No such file or directory)\r\nstat(\"/home/tim/projects/.cargo/config\", 0x7fffb1eba210) = -1 ENOENT (No such file or directory)\r\nstat(\"/home/tim/.cargo/config\", 0x7fffb1eba210) = -1 ENOENT (No such file or directory)\r\nstat(\"/home/.cargo/config\", 0x7fffb1eba210) = -1 ENOENT (No such file or directory)\r\nstat(\"/.cargo/config\", 0x7fffb1eba210)  = -1 ENOENT (No such file or directory)\r\naccess(\"/home/tim/.gitconfig\", F_OK)    = 0\r\nstat(\"/home/tim/.gitconfig\", {st_mode=S_IFREG|0644, st_size=1541, ...}) = 0\r\nstat(\"/home/tim/.gitconfig\", {st_mode=S_IFREG|0644, st_size=1541, ...}) = 0\r\nopen(\"/home/tim/.gitconfig\", O_RDONLY)  = 3\r\naccess(\"/home/tim/.config/git/config\", F_OK) = -1 ENOENT (No such file or directory)\r\naccess(\"/etc/gitconfig\", F_OK)          = -1 ENOENT (No such file or directory)\r\nstat(\"/home/tim/.gitconfig\", {st_mode=S_IFREG|0644, st_size=1541, ...}) = 0\r\nopen(\"/home/rustbuild/root64/ssl/openssl.cnf\", O_RDONLY) = -1 ENOENT (No such file or directory)\r\nstat(\"/var/ssl\", 0x7fffb1eba7a0)        = -1 ENOENT (No such file or directory)\r\nstat(\"/usr/share/ssl\", 0x7fffb1eba7a0)  = -1 ENOENT (No such file or directory)\r\nstat(\"/usr/local/ssl\", 0x7fffb1eba7a0)  = -1 ENOENT (No such file or directory)\r\nstat(\"/usr/local/openssl\", 0x7fffb1eba7a0) = -1 ENOENT (No such file or directory)\r\nstat(\"/usr/local/share\", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0\r\nstat(\"/usr/lib/ssl\", 0x7fffb1eba7a0)    = -1 ENOENT (No such file or directory)\r\nstat(\"/usr/ssl\", 0x7fffb1eba7a0)        = -1 ENOENT (No such file or directory)\r\nstat(\"/etc/openssl\", 0x7fffb1eba7a0)    = -1 ENOENT (No such file or directory)\r\nstat(\"/etc/pki/tls\", 0x7fffb1eba7a0)    = -1 ENOENT (No such file or directory)\r\nstat(\"/etc/ssl\", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0\r\nopen(\"/etc/hosts\", O_RDONLY|O_CLOEXEC)  = 3\r\nopen(\"/etc/gai.conf\", O_RDONLY|O_CLOEXEC) = 3\r\nstat(\"/dev/urandom\", {st_mode=S_IFCHR|0666, st_rdev=makedev(1, 9), ...}) = 0\r\nopen(\"/dev/urandom\", O_RDONLY)          = 4\r\nopen(\"/etc/ssl/cert.pem\", O_RDONLY)     = 4\r\nopen(\"/etc/hosts\", O_RDONLY|O_CLOEXEC)  = 4\r\nopen(\"/etc/ssl/cert.pem\", O_RDONLY)     = 5\r\nstat(\"/etc/ssl/certs/415660c1.0\", 0x7fffb1eba1e0) = -1 ENOENT (No such file or directory)\r\nUnable to get packages from source\r\n\r\nCaused by:\r\n  Failed to download package `pkg-config v0.0.1` from https://crates.io/api/v1/crates/pkg-config/0.0.1/download\r\n\r\nCaused by:\r\n  Peer certificate cannot be authenticated with given CA certificates\r\n+++ exited with 101 +++\r\n```\r\n\r\nSo it looks like the curl module is not looking at the correct place for certificate checking and so far my attempts to use environment variables such as `CURL_CA_BUNDLE` have been unsuccessful with cargo.\r\n\r\nThis may be a rust-curl bug but I can't confirm this because trying to build a minimal example with the curl-rust crate using cargo fails with the same error :(."},"comment":{"url":"https://api.github.com/repos/rust-lang/cargo/issues/comments/118573263","html_url":"https://github.com/rust-lang/cargo/issues/976#issuecomment-118573263","issue_url":"https://api.github.com/repos/rust-lang/cargo/issues/976","id":118573263,"user":{"login":"tksfz","id":507497,"avatar_url":"https://avatars.githubusercontent.com/u/507497?v=3","gravatar_id":"","url":"https://api.github.com/users/tksfz","html_url":"https://github.com/tksfz","followers_url":"https://api.github.com/users/tksfz/followers","following_url":"https://api.github.com/users/tksfz/following{/other_user}","gists_url":"https://api.github.com/users/tksfz/gists{/gist_id}","starred_url":"https://api.github.com/users/tksfz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tksfz/subscriptions","organizations_url":"https://api.github.com/users/tksfz/orgs","repos_url":"https://api.github.com/users/tksfz/repos","events_url":"https://api.github.com/users/tksfz/events{/privacy}","received_events_url":"https://api.github.com/users/tksfz/received_events","type":"User","site_admin":false},"created_at":"2015-07-05T03:08:47Z","updated_at":"2015-07-05T03:08:47Z","body":"Same here  (works on 1.2  beta and 1.3  nightly;  breaks  on  stable 1.1)."}}