Add support for new Apple trust APIs with WOLFSSL_SYS_CA_CERTS#6869
Merged
dgarske merged 2 commits intowolfSSL:masterfrom Oct 18, 2023
Merged
Add support for new Apple trust APIs with WOLFSSL_SYS_CA_CERTS#6869dgarske merged 2 commits intowolfSSL:masterfrom
dgarske merged 2 commits intowolfSSL:masterfrom
Conversation
Contributor
Author
|
Jenkins retest this please |
JacobBarthelmeh
approved these changes
Oct 18, 2023
dgarske
approved these changes
Oct 18, 2023
Member
There was a problem hiding this comment.
Approved and merging as-is. Only way to trigger use case is the example/client --sys-ca-certs argument. Also my old Mac OS 11.7 supported the new method fine. We need to add WOLFSSL_APPLE_NATIVE_CERT_VALIDATION to the documentation. For testing I added two lines to suites.c and was able to see proper failure cases.
static char sysCaCerts[] = "--sys-ca-certs";
cliArgs[cliArgsSz++] = sysCaCerts;
And built with: ./configure --enable-sys-ca-certs CFLAGS="-DWOLFSSL_APPLE_NATIVE_CERT_VALIDATION" && make
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
This PR adds support for the new Apple trust validation APIs when using the WOLFSSL_SYS_CA_CERTS option. It adds a new cert verification routine that uses Apple Security Framework APIs to verify peer certs against the system trust store. When this option is enabled, wolfSSL will first attempt to validate against loaded certificates (the current method), and if unsuccessful, invoke the new system validation routine to try and verify the peer.
Why?
Apple deprecated the
SecTrustSettingsCopyCertificatesfor all devices other than Macs, which prevents applications from obtaining certificates from the system trust store. Because we can't grab certs from the system anymore, we can't load them into wolfSSL, and therefore can't use wolfSSL's built-in certificate validation mechanisms.How?
The new routine uses SecTrustEvaluateWithError() to evaluate the trust of peer certificates, based on the SSL trust policy.
See also:
API changes
This new feature is mostly backwards compatible with current API behavior: to use it, the user must enable the
WOLFSSL_SYS_CA_CERTSoption (--enable-sys-ca-certs) and callwolfSSL_CTX_load_system_CA_certs()for it to work.The only external differences are:
WOLFSSL_APPLE_NATIVE_CERT_VALIDATION) was introduced to override the autoconf/Cmake generated header file macros that gate this feature, making it easier foruser_settings.hbuilds to utilize it (user only needs to define one feature macro vs. defining three header detection macros)Testing
examples/client/clientfrom mac laptop, when forcing new validation flow usingWOLFSSL_APPLE_NATIVE_CERT_CHAIN_VALIDATIONmake checktests all pass when this option is enabled, which includes cert validation for real TLS connectionsFeedback Requested:
ProcessPeerCerts(). It works, but perhaps there is a better/cleaner way to do it.ProcessPeerCertsis 20k+ lines long, so it was tough to keep track of everything that is going on there. If how I've implemented it seems brittle or not robust, I'd like to change that before merging. Any feedback would be appreciatedChecklist