<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugzilla.yoctoproject.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugzilla.yoctoproject.org/"
          
          maintainer="it-coreprojects-helpdesk@linuxfoundation.org"
>

    <bug>
          <bug_id>9883</bug_id>
          
          <creation_ts>2016-07-06 08:41:47 +0000</creation_ts>
          <short_desc>curl-native: invalid builtin ca-bundle path when restoring from sstate</short_desc>
          <delta_ts>2026-01-22 16:31:01 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>7</classification_id>
          <classification>Build System, Metadata &amp; Runtime</classification>
          <product>OE-Core</product>
          <component>core</component>
          <version>2.1</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Medium+</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>Future</target_milestone>
          <dependson>9242</dependson>
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Patrick Ohly">patrick.ohly</reporter>
          <assigned_to name="Unassigned">unassigned</assigned_to>
          <cc>jku</cc>
    
    <cc>meta.mr.watcher</cc>
    
    <cc>meta.watcher</cc>
    
    <cc>p.lobacz</cc>
    
    <cc>pascal.bach</cc>
    
    <cc>paul</cc>
    
    <cc>phil</cc>
    
    <cc>ross.burton</cc>
    
    <cc>sgw</cc>
    
    <cc>tim.orling</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>No (bug/feature does not impact docs)</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>63665</commentid>
    <comment_count>0</comment_count>
    <who name="Patrick Ohly">patrick.ohly</who>
    <bug_when>2016-07-06 08:41:47 +0000</bug_when>
    <thetext>--with-ca-bundle=${sysconfdir}/ssl/certs/ca-certificates.crt in curl_7.41.1.bb causes the current build host&apos;s sysroot path to be compiled into libcurl. That path is not necessarily valid when restoring that library from sstate on another host, which then causes SSL certificate validation to fail due to the missing ca-certificates.crt file.

Restoring from sstate should patch this string (best solution?) or some environment variable should be checked to override the invalid path at runtime (but then invoking tools which use this libcurl must always be done with that env variable set, which is not guaranteed when some user calls them directly outside of bitbake).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>63727</commentid>
    <comment_count>1</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2016-07-07 15:10:31 +0000</bug_when>
    <thetext>In the long term bug 9242 is hopefully the solution here. In the short term, the caller should tell curl where to look.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>67479</commentid>
    <comment_count>2</comment_count>
    <who name="Pascal Bach">pascal.bach</who>
    <bug_when>2016-10-24 14:02:13 +0000</bug_when>
    <thetext>Our solution for this problem was to just not hardcode the path in the native version. This means it will fall back to the host ca-certificates.

Might this be an acceptable solution for upstream?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>70503</commentid>
    <comment_count>3</comment_count>
    <who name="Jussi Kukkonen">jku</who>
    <bug_when>2017-02-07 17:27:43 +0000</bug_when>
    <thetext>This bug became more visible with recipe-specific sysroots:
The sysroot that native libcurl refers to is its own sysroot: it is very likely to not exist when used from a binary in another sysroot.

I&apos;ll send a patch to use host certs for native, but other options are welcome too.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>70504</commentid>
    <comment_count>4</comment_count>
    <who name="Patrick Ohly">patrick.ohly</who>
    <bug_when>2017-02-07 17:38:25 +0000</bug_when>
    <thetext>(In reply to comment #3)
&gt; This bug became more visible with recipe-specific sysroots:
&gt; The sysroot that native libcurl refers to is its own sysroot: it is very
&gt; likely to not exist when used from a binary in another sysroot.
&gt; 
&gt; I&apos;ll send a patch to use host certs for native, but other options are
&gt; welcome too.

The path to the host certs is not the same when moving the binary from one host machine to another via sstate reuse, i.e. that approach does not solve the problem completely.

I&apos;m not sure whether an interim solution is useful. I myself would prefer a proper solution, even if it is harder to implement.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>70600</commentid>
    <comment_count>5</comment_count>
    <who name="Jussi Kukkonen">jku</who>
    <bug_when>2017-02-09 18:12:16 +0000</bug_when>
    <thetext>(In reply to comment #4)
&gt; The path to the host certs is not the same when moving the binary from one
&gt; host machine to another via sstate reuse, i.e. that approach does not solve
&gt; the problem completely.

This is true... I&apos;ve ported your --cacert patch for cve-check-tool so the immediate need is no longer there for me either.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>71201</commentid>
    <comment_count>6</comment_count>
    <who name="Phil Wise">phil</who>
    <bug_when>2017-03-13 07:46:44 +0000</bug_when>
    <thetext>We hit this problem with the OSTree uploader in meta-updater.  I think &apos;right&apos; solution for us is to be explicit about the CA certificates, either by including the relevant root CA in the credentials bundle sent to the client (aka certificate pinning) or by depending on ca-certificates explicitly in the uploader.

Removing the hard-coded path in curl-native would at least force everyone to face this up-front, but might break too much existing (mostly) working code.

What about including ${sysconfdir}, and thus the ca-certificates path in the SSTATE cache key calculation?  This would stop (possibly invalid) cache hits in the case where people are sharing the sstate cache between machines.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>95627</commentid>
    <comment_count>7</comment_count>
    <who name="Tim Orling">tim.orling</who>
    <bug_when>2023-06-02 21:44:19 +0000</bug_when>
    <thetext>I just hit this again. Not entirely certain it is only sstate related.

The issue came up when building a recipe where and npm module (zeromq@6.0.0-beta.16) needs to download a tarball from https://github.com</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>95628</commentid>
    <comment_count>8</comment_count>
    <who name="Tim Orling">tim.orling</who>
    <bug_when>2023-06-03 16:37:11 +0000</bug_when>
    <thetext>In my case, a workaround was to add the following to the recipe which needed
curl https during do_compile():

+# Needed for npm to be able to curl https://
+DEPENDS += &quot;ca-certificates-native&quot;
+export CURL_CA_BUNDLE=&quot;${STAGING_DIR_NATIVE}${sysconfdir_native}/ssl/certs/ca-certificates.crt&quot;
+</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>97217</commentid>
    <comment_count>9</comment_count>
    <who name="Piotr Łobacz">p.lobacz</who>
    <bug_when>2023-11-07 15:46:13 +0000</bug_when>
    <thetext>In my case the isssue is more complicated I don&apos;t even have this ca-certificates.crt in curl-native/7.82.0-r0/recipe-sysroot-native/etc/ssl/certs path which is odd...</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>104037</commentid>
    <comment_count>10</comment_count>
    <who name="Paul Barker">paul</who>
    <bug_when>2026-01-22 16:31:01 +0000</bug_when>
    <thetext>We discussed this on the bug triage call as it&apos;s been inactive for so long.

The issue is that default paths are hardcoded into openssl during build and it&apos;s not possible to relocate them when restoring sstate into a different build path. We&apos;ve tried to get this fixed upstream (https://github.com/openssl/openssl/pull/19260) but progress has stalled. Help is wanted to get this moving again with openssl.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>