mirror of
https://github.com/curl/curl.git
synced 2026-08-26 20:23:32 +03:00
curl: add options for safe/no CA bundle search (Windows)
Add `CURL_CA_SEARCH_SAFE` build-time option to enable CA bundle search
in the `curl` tool directory. The lookup method was already used to find
`.curlrc` and `_curlrc` (on Windows). On Windows it overrides the unsafe
default `SearchPath()` method.
Enable with:
- cmake: `-DCURL_CA_SEARCH_SAFE=ON`
- autotools: `--enable-ca-search-safe`
- raw: `CPPFLAGS=-DCURL_CA_SEARCH_SAFE`
On Windows, before this patch the whole `PATH` was searched for
a CA bundle. `PATH` may contain unwanted or world-writable locations,
including the current directory. Searching them all is convenient to
pick up any CA bundle, but not secure.
The Muldersoft curl distro implements such CA search via a custom
patch for Windows:
cd652d4792/patch/curl_tool_doswin.diff (L50)
MSYS2/mingw-w64 distro has also been rolling a patch solving this:
https://github.com/msys2/MINGW-packages/blob/master/mingw-w64-curl/0001-Make-cURL-relocatable.patch
https://github.com/msys2/MINGW-packages/blob/master/mingw-w64-curl/pathtools.c
Also add option to fully disable Windows CA search:
- cmake: `-DCURL_DISABLE_CA_SEARCH=ON`
- autotools: `--disable-ca-search`
- raw: `CPPFLAGS=-DCURL_DISABLE_CA_SEARCH`.
Both options are considered EXPERIMENTAL, with possible incompatible
changes or even (partial) removal in the future, depending on feedback.
An alternative, secure option is to embed the CA bundle into the binary.
Safe search can be extended to other platforms if necessary or useful,
by using `_NSGetExecutablePath()` (macOS),
`/proc/self/exe` (Linux/Cygwin), or `argv[0]`.
Closes #14582
This commit is contained in:
parent
668584a94f
commit
22652a5a4c
14 changed files with 131 additions and 43 deletions
44
configure.ac
44
configure.ac
|
|
@ -2184,6 +2184,50 @@ fi
|
|||
|
||||
AM_CONDITIONAL(CURL_CA_EMBED_SET, test "x$CURL_CA_EMBED" != "x")
|
||||
|
||||
dnl ----------------------
|
||||
dnl check unsafe CA search
|
||||
dnl ----------------------
|
||||
|
||||
if test "$curl_cv_native_windows" = "yes"; then
|
||||
AC_MSG_CHECKING([whether to enable unsafe CA bundle search in PATH on Windows])
|
||||
AC_ARG_ENABLE(ca-search,
|
||||
AS_HELP_STRING([--enable-ca-search],[Enable unsafe CA bundle search in PATH on Windows (default)])
|
||||
AS_HELP_STRING([--disable-ca-search],[Disable unsafe CA bundle search in PATH on Windows]),
|
||||
[ case "$enableval" in
|
||||
no)
|
||||
AC_MSG_RESULT([no])
|
||||
AC_DEFINE(CURL_DISABLE_CA_SEARCH, 1, [If unsafe CA bundle search in PATH on Windows is disabled])
|
||||
;;
|
||||
*)
|
||||
AC_MSG_RESULT([yes])
|
||||
;;
|
||||
esac ],
|
||||
AC_MSG_RESULT([yes])
|
||||
)
|
||||
fi
|
||||
|
||||
dnl --------------------
|
||||
dnl check safe CA search
|
||||
dnl --------------------
|
||||
|
||||
if test "$curl_cv_native_windows" = "yes"; then
|
||||
AC_MSG_CHECKING([whether to enable safe CA bundle search (within the curl tool directory) on Windows])
|
||||
AC_ARG_ENABLE(ca-search-safe,
|
||||
AS_HELP_STRING([--enable-ca-search-safe],[Enable safe CA bundle search])
|
||||
AS_HELP_STRING([--disable-ca-search-safe],[Disable safe CA bundle search (default)]),
|
||||
[ case "$enableval" in
|
||||
yes)
|
||||
AC_MSG_RESULT([yes])
|
||||
AC_DEFINE(CURL_CA_SEARCH_SAFE, 1, [If safe CA bundle search is enabled])
|
||||
;;
|
||||
*)
|
||||
AC_MSG_RESULT([no])
|
||||
;;
|
||||
esac ],
|
||||
AC_MSG_RESULT([no])
|
||||
)
|
||||
fi
|
||||
|
||||
dnl **********************************************************************
|
||||
dnl Check for libpsl
|
||||
dnl **********************************************************************
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue