Skip to content

also set $CARGO_HTTP_CAINFO on RHEL systems #290

Open
EESSI/software-layer
#1939

Description

@bedroge

While debugging a Rust problem, I just ran into this error on a Rocky 8 node:

$ cargo add bitvec
    Updating crates.io index
error: download of config.json failed

Caused by:
  failed to download from `https://index.crates.io/config.json`

Caused by:
  [77] Problem with the SSL CA cert (path? access rights?) (error setting certificate file: /etc/ssl/certs/ca-certificates.crt)

We already set a bunch of variables on RHEL-based systems, see:
https://github.com/EESSI/software-layer-scripts/blob/main/init/modules/EESSI/2023.06.lua#L286

But for Cargo we also need to set $CARGO_HTTP_CAINFO to the same path; that solved the issue for me:

$ export CARGO_HTTP_CAINFO=/etc/pki/tls/certs/ca-bundle.crt
$ cargo add bitvec
    Updating crates.io index
      Adding bitvec v1.1.1 to dependencies
             Features:
             + alloc
             + atomic
             + std
             - serde
             - testing
    Updating crates.io index
     Locking 5 packages to latest Rust 1.91.1 compatible versions

Activity

  1. HaoZeke commented on Nov 4, 2026

    @HaoZeke
    Contributor

    I can reproduce this on Rocky Linux 9.3 with EESSI 2026.06.
    CARGO_HTTP_CAINFO fixes cargo, but other programs that link to the EESSI libcurl.so.4 still fail.
    Only the curl binary reads CURL_CA_BUNDLE, and libcurl 8.17.0 ignores SSL_CERT_FILE.
    So cargo 1.94.1, or any small C program that calls curl_easy_perform, stops with error 77 on RHEL:

    [77] Problem with the SSL CA cert (path? access rights?) (error adding trust anchors from file: /etc/ssl/certs/ca-certificates.crt)
    

    Minimal reproducer, with CURL_CA_BUNDLE, SSL_CERT_FILE, SSL_CERT_DIR and CARGO_HTTP_CAINFO unset:

    #include <stdio.h>
    #include <curl/curl.h>
    int main(void) {
        CURL *h = curl_easy_init();
        curl_easy_setopt(h, CURLOPT_URL, "https://github.com/robots.txt");
        CURLcode rc = curl_easy_perform(h);
        fprintf(stderr, "%s\n", curl_easy_strerror(rc));
        return (int)rc;
    }
    module load cURL/8.17.0-GCCcore-15.2.0
    gcc -o mwe mwe.c $(curl-config --cflags --libs) -Wl,-rpath,"$EBROOTCURL/lib"
    ./mwe
    

    Basically, the build is buggy, since curl-config --ca prints /etc/ssl/certs/ca-certificates.crt for cURL 8.17.0 in 2026.06 and for 8.7.1, 8.11.1 and 8.14.1 in 2025.06.
    Configure found that path when cURL was built and compiled it in.
    This is the same bug as software-layer#46, and the second option listed there still looks right to me: build cURL so that it uses the compat layer certificates.

    Adding --with-ca-fallback alone does not work.
    In curl 8.17.0, lib/vtls/openssl.c returns CURLE_SSL_CACERT_BADFILE as soon as the compiled-in bundle is missing, and the fallback code comes after that return.
    The bundle and path also have to stay unset:

    --without-ca-bundle --without-ca-path --with-ca-fallback
    

    With the bundle and path unset, libcurl uses the OpenSSL default store, and the 2026.06 OpenSSL has OPENSSLDIR in the compat layer.
    I rebuilt cURL 8.17.0-GCCcore-15.2.0 that way with a parse hook for 2025.06 and 2026.06.
    The C program, curl and cargo search serde against the rebuilt library then all exit 0 on Rocky Linux 9.3 and on Ubuntu 24.04, with no CA variables set.
    One caveat: cargo only picks this up once Rust links to the rebuilt cURL.

    I think this should be in a PR that adds the hook to eb_hooks.py?
    CURL_CA_BUNDLE, #190 could stay as it is.

  2. HaoZeke commented on Nov 12, 2026

    @HaoZeke
    Contributor

    The cURL side is now in three PRs:

    I went with the sysroot bundle after discussing with @casparvl since it seems likely that we'd want this to be from the compat layer.

    Test builds with EasyBuild 5.4.2 under EESSI-extend:

    • 2026.06, cURL 8.17.0, x86_64: curl-config --ca is /cvmfs/software.eessi.io/versions/2026.06/compat/linux/x86_64/etc/ssl/certs/ca-certificates.crt
    • 2025.06, cURL 8.14.1, x86_64: the 2025.06 compat layer bundle
    • 2026.06, cURL 8.17.0, aarch64: /cvmfs/software.eessi.io/versions/2026.06/compat/linux/aarch64/etc/ssl/certs/ca-certificates.crt

    curl -v https://github.com verifies against that bundle in all three.
    Test reports are on easybuilders/easybuild-easyconfigs#27426.

    A 2025.06 rebuild for 8.7.1, 8.11.1 and 8.14.1 is still to do, and cargo needs a Rust built against the new libcurl.
    CARGO_HTTP_CAINFO in the module file is still worth adding for the RHEL path.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions