Repository navigation
Conversation
6fe2b3c to
778f760
Compare
bagder
left a comment
There was a problem hiding this comment.
It might make sense to display this as a feature in curl -V so that a user can tell if it has a cacert bundle built-in or not.
3a3db00 to
21808ed
Compare
This comment was marked as resolved.
This comment was marked as resolved.
When malloc fails (which is basically not possible on most modern systems) we should bail out. Not try something else. IMHO. |
|
Thanks, I agree, leaving it as-is. On another question: Do we want a It'd be useful for transparency, i.e. to see the trusted roots without peeking into the binary with a capable viewer (or |
I think such a command line option makes a lot of sense, yes. I don't have any better name suggestion! |
|
I went with |
b85cd0b to
c36e110
Compare
And use it when available. It enables this feature in the active PR: curl/curl#14059
|
Patch that allows disabling the Windows-specific --- a/src/tool_doswin.c
+++ b/src/tool_doswin.c
@@ -621,7 +621,7 @@ CURLcode FindWin32CACert(struct OperationConfig *config,
{
CURLcode result = CURLE_OK;
-#ifdef CURL_WINDOWS_APP
+#if defined(CURL_WINDOWS_APP) || defined(CURL_WINDOWS_SKIP_SEARCHPATH_CACERT)
(void)config;
(void)backend;
(void)bundle_file;This option becomes useful when combined with embedded bundles, as it prevents curl from picking one up from a "random" disk location, including world-writable ones. It still allows to specify one manually either via the documented envs or command-line / Does this make sense? Does it raise any concern? |
|
Embedded certs is now tested via curl-for-win. Also in this PR, after this commit and re-running the workflow: curl/curl-for-win@b4945dd |
A downside with compressing this: Since the TLS libraries cannot use the blob compressed, this would then have to use 230KB allocated memory to store the cacert bundle in, in addition to the 130KB compressed read-only memory already used for the compressed image. Thus spending more total memory in run-time than doing it completely uncompressed will need... |
|
Compiling with Is this intentional? Why not a |
|
Thanks for your feedback. My thinking is that an empty output is a clear sign that there is no embedded CA. Unlike This feature is brand new and I guess time/feedback/contributions will hint what would yet be useful to tweak around it. |
Add missing rule dependency on the user-specified CA bundle. This fixes including it when using the curl distro tarball, and other cases. Also: - fix the internal name of the CA bundle to avoid nested quotes. It broke broke the rule dependency for the make tool. - exclude the generated (empty) `tool_ca_embed.c` file from the distro tarball. Patch-by: Daniel Stenberg Follow-up to 8a3740b #14059 Reported-by: rampageX on github Fixes #14879 Closes #14882
Seen with curl-for-win linux-musl-from-mac build with gcc 9.2.0.
```
n file included from /Users/runner/work/curl-for-win/curl-for-win/curl/_x64-linux-musl-bld/src/CMakeFiles/curl.dir/Unity/unity_0_c.c:136:
/Users/runner/work/curl-for-win/curl-for-win/curl/_x64-linux-musl-bld/src/tool_ca_embed.c:4:28: warning: redundant redeclaration of 'curl_ca_embed' [-Wredundant-decls]
4 | extern const unsigned char curl_ca_embed[];
| ^~~~~~~~~~~~~
In file included from /Users/runner/work/curl-for-win/curl-for-win/curl/_x64-linux-musl-bld/src/CMakeFiles/curl.dir/Unity/unity_0_c.c:88:
/Users/runner/work/curl-for-win/curl-for-win/curl/src/tool_operate.c:107:28: note: previous declaration of 'curl_ca_embed' was here
107 | extern const unsigned char curl_ca_embed[];
| ^~~~~~~~~~~~~
```
https://github.com/curl/curl-for-win/actions/runs/11192203640/job/31116070669#step:3:4894
Follow-up to 8a3740b #14059
Closes #15307
Add missing rule dependency on the user-specified CA bundle. This fixes including it when using the curl distro tarball, and other cases. Also: - fix the internal name of the CA bundle to avoid nested quotes. It broke broke the rule dependency for the make tool. - exclude the generated (empty) `tool_ca_embed.c` file from the distro tarball. Patch-by: Daniel Stenberg Follow-up to 8a3740b curl#14059 Reported-by: rampageX on github Fixes curl#14879 Closes curl#14882
Follow-up to 8a3740b curl#14059 Closes curl#15027
Seen with curl-for-win linux-musl-from-mac build with gcc 9.2.0.
```
n file included from /Users/runner/work/curl-for-win/curl-for-win/curl/_x64-linux-musl-bld/src/CMakeFiles/curl.dir/Unity/unity_0_c.c:136:
/Users/runner/work/curl-for-win/curl-for-win/curl/_x64-linux-musl-bld/src/tool_ca_embed.c:4:28: warning: redundant redeclaration of 'curl_ca_embed' [-Wredundant-decls]
4 | extern const unsigned char curl_ca_embed[];
| ^~~~~~~~~~~~~
In file included from /Users/runner/work/curl-for-win/curl-for-win/curl/_x64-linux-musl-bld/src/CMakeFiles/curl.dir/Unity/unity_0_c.c:88:
/Users/runner/work/curl-for-win/curl-for-win/curl/src/tool_operate.c:107:28: note: previous declaration of 'curl_ca_embed' was here
107 | extern const unsigned char curl_ca_embed[];
| ^~~~~~~~~~~~~
```
https://github.com/curl/curl-for-win/actions/runs/11192203640/job/31116070669#step:3:4894
Follow-up to 8a3740b curl#14059
Closes curl#15307
Reported-by: rainerjung in github Co-authored-by: rainerjung in github Fixes curl#21970 Follow-up to 8a3740b curl#14059
Reported-by: rainerjung in github Co-authored-by: rainerjung in github Fixes curl#21970 Follow-up to 8a3740b curl#14059
Add the ability to embed a CA bundle into the curl binary. It is used
when no other runtime or build-time option set one.
This helps curl-for-win macOS and Linux builds to run standalone, and
also helps Windows builds to avoid picking up the CA bundle from an
arbitrary (possibly world-writable) location (though this behaviour is
not currently disablable).
Usage:
-DCURL_CA_EMBED=/path/to/curl-ca-bundle.crt--with-ca-embed=/path/to/curl-ca-bundle.crtCURL_CA_EMBED=/path/to/curl-ca-bundle.crtAlso add new command-line option
--dump-ca-embedto dump the embeddedCA bundle to standard output.
Closes #14059
TODO:
Ideas:
gzipped embedding? (230KB → 130KB)with reusable unzipper function inside
src/tool_something.cgenerate the dummytool_ca_embed.calso in CMake/Makefile.mk to keep binary output in sync? (though the dummy code is likely discarded by the linker in autotools builds.)FindWin32CACert()feature? → curl: add options for safe/no CA bundle search (Windows) #14582