Skip to content

Conversation

@icing
Copy link
Contributor

@icing icing commented Sep 24, 2025

  • configure/cmake support for enabling the option
  • supported in OpenSSL and GnuTLS backends
  • when configured, Apple SecTrust is the default trust store for peer verification. When one of the CURLOPT_* for adding certificates is used, that default does not apply.
  • add documentation of build options and SSL use

@github-actions github-actions bot added cmdline tool tests CI Continuous Integration labels Sep 24, 2025
@icing icing added TLS appleOS specific to an Apple operating system and removed cmdline tool tests CI Continuous Integration labels Sep 24, 2025
@github-actions github-actions bot added cmdline tool tests CI Continuous Integration labels Sep 24, 2025
@icing icing requested review from bagder, jay and vszakats September 24, 2025 09:54
@icing
Copy link
Contributor Author

icing commented Sep 24, 2025

This is my suggestion on how to add this feature. We could maybe extend this to mbedTLS and wolfSSL, but I was not sure it is worth it. OpenSSL(-like)+GnuTLS should be enough for the start.

The specific behaviour I designed for is:

# uses Apple SecTrust
> curl https://example.com

# uses *only* certs from file.pem
> curl --cacert file.pem https://example.com

# uses *both* certs from file.pem and SecTrust
> curl --ca-native --cacert file.pem https://example.com

This would also happen for a libcurl application. SecTrust would only be used when the applications does not configure any ca file/path/blob. What is currently not possible is:

# still uses Apple SecTrust
> curl --no-ca-native https://example.com

because I could not think of a way to decide if CURLOPT_SSL_OPTIONS flags did just omit CURLSSLOPT_NATIVE_CA because it did not matter before or if it was intentionally left out.

@jay
Copy link
Member

jay commented Sep 24, 2025

# still uses Apple SecTrust
> curl --no-ca-native https://example.com

because I could not think of a way to decide if CURLOPT_SSL_OPTIONS flags did just omit CURLSSLOPT_NATIVE_CA because it did not matter before or if it was intentionally left out.

That's right it only disables the option which disables passing the flag.

@jay
Copy link
Member

jay commented Sep 24, 2025

I don't know enough Apple to formally review this so I'm going to have to punt. I did take a look at it and left some comments though.

@icing icing force-pushed the apple-sectrust branch 2 times, most recently from 3efe2dc to ab78e43 Compare September 26, 2025 08:36
@bagder
Copy link
Member

bagder commented Oct 2, 2025

Hm, this gets some new CI failures we need to check first

icing added 4 commits October 3, 2025 09:26
- configure/cmake support for enabling the option
- supported in OpenSSL and GnuTLS backends
- when configured, Apple SecTrust is the default trust store
  for peer verification. When one of the CURLOPT_* for adding
  certificates is used, that default does not apply.
- add documentation of build options and SSL use
icing added 2 commits October 3, 2025 09:26
- re-add backend Schannel check to not apply default BUNDLE/PATH
- fix wording/formatting in SSLCERTS.md
- clarify fallback option in INSTALL.md
@icing icing requested a review from bagder October 3, 2025 08:06
Copy link
Member

@vszakats vszakats left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One minor, likely unrelated, log issue I noticed while testing, is that --doh-url seems to suppress the SSL Trust Anchors: info.

Using the -DUSE_APPLE_SECTRUST=ON dev build curl-macos-universal-clang from https://github.com/curl/curl-for-win/actions/runs/18216661900

$ CURL_CA_BUNDLE=/opt/homebrew/etc/ca-certificates/cert.pem ./curl -q --doh-url https://zero.dns0.eu/ -v https://curl.se/ --out-null

it does only say SSL certificate verified via OpenSSL..

With --doh-url <url> deleted, SSL Trust Anchors: appears as expected.

@icing
Copy link
Contributor Author

icing commented Oct 3, 2025

Good catch, @vszakats . I need to inspect the DoH code on how it tries to set ca-bundle/-path/native from the initiating transfer.

Update: but when you explicity specify a CA-Bundle, as command line options or via env var, the native CA is turned off. You need to add --ca-native to include it.

@bagder bagder closed this in eefd03c Oct 3, 2025
nono303 pushed a commit to nono303/win-build-scripts that referenced this pull request Oct 22, 2025
vszakats added a commit that referenced this pull request Nov 6, 2025
Syncing behavior with `CURL_CA_BUNDLE` and autotools.

`/etc/ssl/certs` is empty by default on macOS systems, thus no likely
auto-detection finds something there.

Follow-up to eefd03c #18703

Closes #19380
vszakats added a commit to vszakats/curl that referenced this pull request Nov 27, 2025
vszakats added a commit that referenced this pull request Nov 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

appleOS specific to an Apple operating system CI Continuous Integration cmdline tool tests TLS

Development

Successfully merging this pull request may close these issues.

5 participants