summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorMoritz Haase <Moritz.Haase@bmw.de>2025-12-22 12:24:54 +0100
committerSteve Sakoman <steve@sakoman.com>2025-12-31 07:49:31 -0800
commitd792f1a83e10d8f11b8824caef89079e684d56e0 (patch)
treea9e25618cacc7cb498006e5e8a04b288294ae4d7 /meta
parent1df6f0ae9166861d56c4e312d4f9c26ea6cdccb9 (diff)
downloadpoky-d792f1a83e10d8f11b8824caef89079e684d56e0.tar.gz
curl: Use host CA bundle by default for native(sdk) builds
Fixes YOCTO #16077 Commit 0f98fecd (a backport of 4909a46e) broke HTTPS downloads in opkg in the SDK, they now fail with: > SSL certificate problem: self-signed certificate in certificate chain The root cause is a difference in the handling of related env vars between curl-cli and libcurl. The CLI will honour CURL_CA_BUNDLE and SSL_CERT_DIR|FILE (see [0]). Those are set in the SDK via env setup scripts like [1], so curl continued to work. The library however does not handle those env vars. Thus, unless the program utilizing libcurl has implemented a similar mechanism itself and configures libcurl accordingly via the API (like for example Git in [2] and [3]), there will be no default CA bundle configured to verify certificates against. Opkg only supports setting the CA bundle path via config options 'ssl_ca_file' and 'ssl_ca_path'. Upstreaming and then backporting a patch to add env var support is not a feasible short-time fix for the issue at hand. Instead it's better to ship libcurl in the SDK with a sensible built-in default - which also helps any other libcurl users. This patch is based on a proposal by Peter.Marko@siemens.com in the related mailing list discussion at [4]. (cherry picked from commit 3f819f57aa1960af36ac0448106d1dce7f38c050) [0]: https://github.com/curl/curl/blob/400fffa90f30c7a2dc762fa33009d24851bd2016/src/tool_operate.c#L2056-L2084 [1]: https://git.openembedded.org/openembedded-core/tree/meta/recipes-support/curl/curl/environment.d-curl.sh?id=3a15ca2a784539098e95a3a06dec7c39f23db985 [2]: https://github.com/git/git/blob/6ab38b7e9cc7adafc304f3204616a4debd49c6e9/http.c#L1389 [3]: https://github.com/git/git/blob/6ab38b7e9cc7adafc304f3204616a4debd49c6e9/http.c#L1108-L1109 [4]: https://lists.openembedded.org/g/openembedded-core/topic/115993530#msg226751 (From OE-Core rev: 0e553b685c0a987a7be1eee16b7b5e3e48a036e2) Signed-off-by: Moritz Haase <Moritz.Haase@bmw.de> CC: matthias.schiffer@ew.tq-group.com CC: Peter.Marko@siemens.com Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> Signed-off-by: Steve Sakoman <steve@sakoman.com>
Diffstat (limited to 'meta')
-rw-r--r--meta/recipes-support/curl/curl_8.7.1.bb11
1 files changed, 8 insertions, 3 deletions
diff --git a/meta/recipes-support/curl/curl_8.7.1.bb b/meta/recipes-support/curl/curl_8.7.1.bb
index 6c02746394..0af6a41399 100644
--- a/meta/recipes-support/curl/curl_8.7.1.bb
+++ b/meta/recipes-support/curl/curl_8.7.1.bb
@@ -92,16 +92,21 @@ PACKAGECONFIG[verbose] = "--enable-verbose,--disable-verbose"
92PACKAGECONFIG[zlib] = "--with-zlib=${STAGING_LIBDIR}/../,--without-zlib,zlib" 92PACKAGECONFIG[zlib] = "--with-zlib=${STAGING_LIBDIR}/../,--without-zlib,zlib"
93PACKAGECONFIG[zstd] = "--with-zstd,--without-zstd,zstd" 93PACKAGECONFIG[zstd] = "--with-zstd,--without-zstd,zstd"
94 94
95# Use host certificates for non-target builds. As libcurl doesn't honor any of the env vars (like
96# for example CURL_CA_PATH) that curl-cli does, we need to explicitly set '--with-ca-bundle'
97# accordingly, so that there is a working, built-in default even for those tools that use libcurl,
98# but don't have custom env var handling implemented (like opkg).
99CURL_CA_BUNDLE_BASE_DIR ?= "/etc"
100CURL_CA_BUNDLE_BASE_DIR:class-target = "${sysconfdir}"
101
95EXTRA_OECONF = " \ 102EXTRA_OECONF = " \
96 --disable-libcurl-option \ 103 --disable-libcurl-option \
97 --disable-ntlm-wb \ 104 --disable-ntlm-wb \
98 --without-libpsl \ 105 --without-libpsl \
99 --enable-optimize \ 106 --enable-optimize \
107 --with-ca-bundle=${CURL_CA_BUNDLE_BASE_DIR}/ssl/certs/ca-certificates.crt \
100 ${@'--without-ssl' if (bb.utils.filter('PACKAGECONFIG', 'gnutls mbedtls openssl', d) == '') else ''} \ 108 ${@'--without-ssl' if (bb.utils.filter('PACKAGECONFIG', 'gnutls mbedtls openssl', d) == '') else ''} \
101" 109"
102EXTRA_OECONF:append:class-target = " \
103 --with-ca-bundle=${sysconfdir}/ssl/certs/ca-certificates.crt \
104"
105 110
106fix_absolute_paths () { 111fix_absolute_paths () {
107 # cleanup buildpaths from curl-config 112 # cleanup buildpaths from curl-config