GNU bug report logs - #37371
CMake’s “ctest” doesn’t know about X.509 certificates

Previous Next

Package: guix;

Reported by: Ludovic Courtès <ludovic.courtes <at> inria.fr>

Date: Tue, 10 Sep 2019 15:38:03 UTC

Severity: normal

Done: Ludovic Courtès <ludo <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 37371 in the body.
You can then email your comments to 37371 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-guix <at> gnu.org:
bug#37371; Package guix. (Tue, 10 Sep 2019 15:38:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to Ludovic Courtès <ludovic.courtes <at> inria.fr>:
New bug report received and forwarded. Copy sent to bug-guix <at> gnu.org. (Tue, 10 Sep 2019 15:38:04 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludovic.courtes <at> inria.fr>
To: bug-Guix <at> gnu.org
Subject: CMake’s “ctest” doesn’t know about
 X.509 certificates
Date: Tue, 10 Sep 2019 17:37:43 +0200
Hello,

The ‘ctest’ command uses libcurl to submit reports to CDash servers.
However, it does not “getenv” anything related to CA certs, and it does
not either look at /etc/ssl/certs.

The culprit is this function:

--8<---------------cut here---------------start------------->8---
std::string cmCurlSetCAInfo(::CURL* curl, const char* cafile)
{
  std::string e;
  if (cafile && *cafile) {
    ::CURLcode res = ::curl_easy_setopt(curl, CURLOPT_CAINFO, cafile);
    check_curl_result(res, "Unable to set TLS/SSL Verify CAINFO: ");
  }
#ifdef CMAKE_FIND_CAFILE
#  define CMAKE_CAFILE_FEDORA "/etc/pki/tls/certs/ca-bundle.crt"
  else if (cmSystemTools::FileExists(CMAKE_CAFILE_FEDORA, true)) {
    ::CURLcode res =
      ::curl_easy_setopt(curl, CURLOPT_CAINFO, CMAKE_CAFILE_FEDORA);
    check_curl_result(res, "Unable to set TLS/SSL Verify CAINFO: ");
  }
#  undef CMAKE_CAFILE_FEDORA
  else {
#  define CMAKE_CAFILE_COMMON "/etc/ssl/certs/ca-certificates.crt"
    if (cmSystemTools::FileExists(CMAKE_CAFILE_COMMON, true)) {
      ::CURLcode res =
        ::curl_easy_setopt(curl, CURLOPT_CAINFO, CMAKE_CAFILE_COMMON);
      check_curl_result(res, "Unable to set TLS/SSL Verify CAINFO: ");
    }
#  undef CMAKE_CAFILE_COMMON
#  define CMAKE_CAPATH_COMMON "/etc/ssl/certs"
    if (cmSystemTools::FileIsDirectory(CMAKE_CAPATH_COMMON)) {
      ::CURLcode res =
        ::curl_easy_setopt(curl, CURLOPT_CAPATH, CMAKE_CAPATH_COMMON);
      check_curl_result(res, "Unable to set TLS/SSL Verify CAPATH: ");
    }
#  undef CMAKE_CAPATH_COMMON
  }
#endif
  return e;
}
--8<---------------cut here---------------end--------------->8---

The problem is that ‘CMAKE_FIND_CAFILE’ is undefined in our case:

--8<---------------cut here---------------start------------->8---
#if !defined(CMAKE_USE_SYSTEM_CURL) && !defined(_WIN32) &&                    \
  !defined(__APPLE__) && !defined(CURL_CA_BUNDLE) && !defined(CURL_CA_PATH)
#  define CMAKE_FIND_CAFILE
#  include "cmSystemTools.h"
#endif
--8<---------------cut here---------------end--------------->8---

Thus it doesn’t look for certificates *at all*, and eventually fails
with:

--8<---------------cut here---------------start------------->8---
   Error when uploading file: …
   Error message was: server certificate verification failed. CAfile: none CRLfile: none
   Problems when submitting via HTTP
Errors while running CTest
--8<---------------cut here---------------end--------------->8---

For now I propose to provide a patched ‘cmake’ package that does the
right thing.

On #guix, Tobias also rightfully suggested adding a ‘getenv’ call
directly in libcurl, which may be the better long-term solution (though
it’s unclear whether that could interfere with application logic.)

Ludo’.




Information forwarded to bug-guix <at> gnu.org:
bug#37371; Package guix. (Tue, 10 Sep 2019 16:36:01 GMT) Full text and rfc822 format available.

Message #8 received at 37371 <at> debbugs.gnu.org (full text, mbox):

From: Ricardo Wurmus <rekado <at> elephly.net>
To: 37371 <at> debbugs.gnu.org
Subject: Re: bug#37371: CMake’s “ctest” doesn’t know about X.509 certificates
Date: Tue, 10 Sep 2019 18:35:03 +0200
Ludovic Courtès <ludovic.courtes <at> inria.fr> writes:

> The ‘ctest’ command uses libcurl to submit reports to CDash servers.
> However, it does not “getenv” anything related to CA certs, and it does
> not either look at /etc/ssl/certs.
[…]
>
> For now I propose to provide a patched ‘cmake’ package that does the
> right thing.

This is the correct way, in my opinion.  The user of libcurl is supposed
to handle environment variable lookup.

> On #guix, Tobias also rightfully suggested adding a ‘getenv’ call
> directly in libcurl, which may be the better long-term solution (though
> it’s unclear whether that could interfere with application logic.)

This idea has been around for a pretty long time.  I don’t really like
it, but it would solve so many problems where users of libcurl don’t do
env var lookups and fall back to the default, which is not guaranteed to
exist when using Guix on foreign distros or even on Guix System.

--
Ricardo





Information forwarded to bug-guix <at> gnu.org:
bug#37371; Package guix. (Tue, 10 Sep 2019 17:06:01 GMT) Full text and rfc822 format available.

Message #11 received at 37371 <at> debbugs.gnu.org (full text, mbox):

From: Tobias Geerinckx-Rice <me <at> tobias.gr>
To: Ricardo Wurmus <rekado <at> elephly.net>
Cc: 37371 <at> debbugs.gnu.org
Subject: Re: bug#37371: CMake’s “ctest” doesn’t know about X.509 certificates
Date: Tue, 10 Sep 2019 19:05:18 +0200
[Message part 1 (text/plain, inline)]
Ricardo,

Ricardo Wurmus 写道:
> This is the correct way, in my opinion.  The user of libcurl is 
> supposed
> to handle environment variable lookup.

I'm aware of this, but it seems like some users don't do this.

>> On #guix, Tobias also rightfully suggested adding a ‘getenv’ 
>> call
>> directly in libcurl, which may be the better long-term solution 
>> (though
>> it’s unclear whether that could interfere with application 
>> logic.)
>
> This idea has been around for a pretty long time.  I don’t 
> really like
> it, but it would solve so many problems where users of libcurl 
> don’t do
> env var lookups and fall back to the default, which is not 
> guaranteed to
> exist when using Guix on foreign distros or even on Guix System.

Yeah, I explicitly said it was evil ;-)

I don't ‘like’ it either, but don't know enough about libcurl to 
think of a better solution.

Kind regards,

T G-R
[signature.asc (application/pgp-signature, inline)]

Reply sent to Ludovic Courtès <ludo <at> gnu.org>:
You have taken responsibility. (Tue, 10 Sep 2019 22:14:02 GMT) Full text and rfc822 format available.

Notification sent to Ludovic Courtès <ludovic.courtes <at> inria.fr>:
bug acknowledged by developer. (Tue, 10 Sep 2019 22:14:02 GMT) Full text and rfc822 format available.

Message #16 received at 37371-done <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Tobias Geerinckx-Rice <me <at> tobias.gr>
Cc: Ricardo Wurmus <rekado <at> elephly.net>, 37371-done <at> debbugs.gnu.org
Subject: Re: bug#37371: CMake’s “ctest” doesn’t know about X.509 certificates
Date: Wed, 11 Sep 2019 00:13:24 +0200
Hello,

Tobias Geerinckx-Rice <me <at> tobias.gr> skribis:

> Ricardo Wurmus 写道:
>> This is the correct way, in my opinion.  The user of libcurl is
>> supposed
>> to handle environment variable lookup.
>
> I'm aware of this, but it seems like some users don't do this.

I’ve pushed this as 489d16577e4a6ccc30f3719d9263900089edd842.

We can revisit the libcurl issue later on (as we regularly do :-)).

Thanks for your feedback,
Ludo’.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 09 Oct 2019 11:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 4 years and 198 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.