-
Notifications
You must be signed in to change notification settings - Fork 17.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
crypto/x509: root_cgo_darwin and root_nocgo_darwin omit some system certs #24652
Comments
Could you tell us more about the certificates not found in the cgo path? Are they set with specific trust policies? Could you paste a certificate that isn't found, but should be? |
Do you know of a way to print/examine the trust policies of a certificate? After some experimentation, we have found that the certificates that aren't showing up seem to say "This certificate has custom trust settings" in the Keychain UI. However, expanding the "Trust" section doesn't reveal any specifics: I'm not sure how the certificate was added/got to this state. It seems that if we manually update the state to "Always Trust" in the Keychain UI, then the certificate is returned. However, we'd like to understand this further, since most apps seem to trust the certificate even with these "Custom" trust settings but Go with CGo does not, which is causing issues for us. *To clarify, I suspect that the issue has to do with the trust settings marked for the certificate rather than with the certificate itself |
(CC: @FiloSottile) |
@jdhenke @nmiyake I've had to add the certificates into either the login keychain or
How are you adding the certs? The Keychain UI is pretty much the easiest way to view trust, but it's not always clear. I've been working on better ways to parse the You can inspect the certs with the tool by running something like, which is what non-cgo Go does:
I've talked about the inverse of this problem (explicit distrust of certificates) at #24084, which has the same confusion/problem. |
Unfortunately, I'm not sure about the provenance of how the cert was added. However, I do suspect that how it was added/how it was upgraded from a previous add is at the root of the issue here. I have a certificate in my System store called "MSCA-ROOT-01-CA". I'm not sure how it was added, but the screenshot earlier in the issue shows that it displays as "This certificate has custom trust settings", although the UI shows "Always Trust" for all the parts. I added some debugging code to
Based my reading of the code, this certificate is in the "Admin" domain and has a non-NULL but empty trust setting. Because the trust setting is empty and it isn't a system cert, it decides not to trust it. This logically makes sense to me, but I guess the resulting behavior isn't consistent with other applications (other applications seem willing to use this certificate for verification). Modified
|
@nmiyake Could you rebase that change off the latest commit on master? There's another change which mixes up the diff a bit. I'm not sure if trusting a certificate without any policies from the user/admin domain would cause problems. If an attacker is modifying your trust policies they can already install a root CA. There is a |
Sure. Here's the modified code on master:
Output was the same:
From what I can tell, I have 3 certificates in my keychain that fit this criteria. Adding this logic fixes the specific issue that we're seeing:
(if this were to be done, I would presume it should probably be done for the case where Interestingly, this doesn't fully resolve the diff for the number of certificates between CGO_ENABLED=0 and 1. My breakdown is:
|
@nmiyake Cool. If you want to submit that There's probably something up with the trust policies on those remaining certificates. Can you run the following?
This dumps plist (xml) files of your certificate trust. The best way to find a specific cert is by the sha1 hash. It's the Can you find a certificate that's added into a keychain, but isn't showing up in Go? I'm curious what The values there are mapped to
I'm building a quick tool to help debug these files. You can run it over the exported plist files and get something that's a bit easier to parse. https://github.com/adamdecaf/plist-parser
|
OK, performed more digging and diagnostics. Here's the overview of my state with the current Go:
After running with my modification proposed above, I get:
I ran your parsing tool on my output, and indeed for some reason there are 3 certificates that explicitly have an empty trust settings set (only showing one here):
I'm not sure how this entry was created for me, but that's clearly the issue. Two of these certificates are valid and are added, and thus increment the "common" count by 2. One of these certificates is expired. This one appears only in the CGo code, which accounts for the "1 CGo only". Here are some of the certificates that show up only for non-CGo (out of the 13):
2 of these have an entry in my
None of the other entries show up in my plist. In the keychain, these show up as "no value specified" for trust: The one curious thing is the extra certificate that shows up for CGo only after the local modification. That certificate is an old CA certificate I have that is expired: It's showing up because before the modification it was in my I don't think this should be an issue since even if the cert is added as a root cert, any code that does validation should properly check the expiration status. |
Change https://golang.org/cl/104735 mentions this issue: |
@nmiyake Cool on that CL. You'll probably want to assign @FiloSottile as a reviewer. As far as the certificates with
Are your trust settings managed by an enterprise or tool by chance? It looks like some tool generated partially invalid policy settings. I've had to work around this and seen it before. Here's an example plist I've seen in the wild. (Note: it's the same
On those 13-2 certificates I wonder again if the plist/trust policies were generated properly. Just search for Can you find any of those certificates on crt.sh? https://crt.sh/?a=1 |
Yes, this behavior is on a machine that's managed by a company and uses tools to do so -- something along the way there writing an invalid policy entry is definitely a possibility. I guess the difference in observed behavior is that most macOS applications (or Apple's cert API itself?) are more lenient on their verification here? Even though strict validation may technically be correct, if it results in an observable difference in behavior between native macOS apps and Go apps with CGo enabled that stills seems like it could be an issue (and I don't really have any good way of knowing how common or uncommon this scenario may be more broadly). |
I don't think we've determined that quite yet. Are any of those 13-2 certs not CA's? I'm reading through the code paths and noticing only the cgo path checks the certificate is a Root CA (by checking Issuer == Subject). Edit: Yep. I verified a non-ca certificate would show up in a non-cgo call to |
Sorry you're right -- the only place where I know that to be true is for the Yes, I think that theory makes sense -- as shows in the UI for the certificates (the last screenshot), all of those certificates seem to be intermediate CAs. If that's the case, I should probably update my PR to set Edit: it didn't fix the issue I was seeing because that cert was a root cert (but just expired). However, functionally I think the change is correct, so updated PR. |
Good. I think we've tracked down the issues. This shows a difference in cgo and non-cgo paths in that cgo only captures the Are you seeing any connection errors from being unable to build a chain? (From these 11 intermediates not being captured?) Looking at the Unix implementation we aren't checking |
@nmiyake Looking through the old CL's I found https://go-review.googlesource.com/c/go/+/64851 (from #16532). |
Ah interesting -- so that approach does use The only added certificate that I regularly use with Go is a custom root certificate, so I would not be impacted by this either way. I don't have a strong opinion on whether or not intermediates should be considered as root -- however, I do think it would be nice for this behavior to be consistent (at a minimum between CGo and non-CGo on Darwin, and in an ideal world across all platforms). If there's a particular test you want me to run around validation with intermediate certs, if you outline it I can give it a stab and update with results. |
cc @FiloSottile Do you have thoughts on |
What's the process to get more eyes on this? Whether it's via my PR or another mechanism, it would be nice to determine a path forward as there are many people on our team who seem to be encountering this issue |
I might have opened a dupe here #25649. Was having a hard time following this issue thread. |
There are multiple issues with our macOS root discovery. The cgo path is unaware of defaults, documented at https://developer.apple.com/documentation/security/1400261-sectrustsettingscopytrustsetting, so it will omit the following certificate.
CL 104735 is an incomplete fix, because if trustSettings are present but don't have a kSecTrustSettingsResult value, it defaults to trustRoot. So it will omit the following certificate.
The nocgo path, on the other hand, asks
Finally, the cgo path is checking if any policy (ssl or any other explicitly set) has a
And I didn't even get into allowed errors. It's fairly late in the freeze, but I'm inclined to fix these, and maybe even backport them, because ignoring the policy types can lead to inclusion of roots that are not supposed to be trusted for TLS, and although crypto/x509 is not TLS-specific, it is meant to serve the WebPKI. @agl agree? @gopherbot please open the backport tracking issues. |
Another test fail Suprisingly I two similar private Root CAs that return different results (see Test Results``` crypto/x509: verify-cert approved CN=Apple Worldwide Developer Relations Certification Authority,OU=Apple Worldwide Developer Relations,O=Apple Inc.,C=US crypto/x509: verify-cert rejected CN=com.apple.systemdefault,O=System Identity: "Cert Verify Result: CSSMERR_TP_NOT_TRUSTED" crypto/x509: verify-cert rejected CN=com.apple.kerberos.kdc,O=System Identity: "Cert Verify Result: CSSMERR_TP_NOT_TRUSTED" crypto/x509: verify-cert approved CN=AutoFirma ROOT crypto/x509: verify-cert approved CN=127.0.0.1 crypto/x509: verify-cert approved CN=BBVA Autoridad de Certificacion Digital,O=Banco Bilbao Vizcaya Argentaria crypto/x509: verify-cert approved CN=BBVA CA Servidores,O=BBVA crypto/x509: verify-cert approved CN=BBVA CA Raiz,O=BBVA crypto/x509: verify-cert approved CN=BBVA Servidores Autoridad de Certificacion Digital,OU=Para Uso Interno BBVA,O=Banco Bilbao Vizcaya Argentaria crypto/x509: verify-cert approved CN=Global Root CA,OU=Security Architecture Cryptography,O=BBVA,C=ES crypto/x509: verify-cert approved CN=Global Root CA Work,OU=Security Architecture Cryptography,O=BBVA,C=ES crypto/x509: verify-cert approved CN=DigiCert Global Root CA,OU=www.digicert.com,O=DigiCert Inc,C=US crypto/x509: verify-cert approved CN=DigiCert SHA2 Secure Server CA,O=DigiCert Inc,C=US crypto/x509: verify-cert approved CN=wifiaccess.grupobbva.com,OU=Comunicaciones,O=BBVA,L=Bilbao,C=ES crypto/x509: verify-cert rejected CN=vpnaas_live.es.nextgen.igrupobbva,OU=Architecture Security,O=BBVA,L=Madrid,ST=Madrid,C=ES: "Cert Verify Result: Invalid Extended Key Usage for policy" crypto/x509: verify-cert approved CN=vpnaas_live.es.nextgen.igrupobbva,OU=Security Architecture,O=BBVA,L=Madrid,ST=Madrid,C=ES crypto/x509: verify-cert approved CN=vpnaas.es.nextgen.igrupobbva,OU=Security Architecture,O=BBVA,L=Madrid,ST=Madrid,C=ES crypto/x509: verify-cert approved CN=isepsncorpeditc2.igrupobbva,O=BBVA,L=Madrid,ST=Madrid,C=ES crypto/x509: verify-cert approved CN=link.live.es.platform.bbva.com,OU=SECURITY,O=BBVA,L=MADRID,ST=MADRID,C=ES crypto/x509: verify-cert rejected CN=armadillo.smlb.secaas-live-es.ext.es.iaas.igrupobbva,OU=Dyd,O=BBVA,L=Madrid,ST=Madrid,C=ES: "Cert Verify Result: CSSMERR_TP_NOT_TRUSTED" crypto/x509: verify-cert approved CN=Developer ID Certification Authority,OU=Apple Certification Authority,O=Apple Inc.,C=US crypto/x509: verify-cert approved CN=Apple Worldwide Developer Relations Certification Authority,OU=Apple Worldwide Developer Relations,O=Apple Inc.,C=US crypto/x509: verify-cert approved CN=Developer Authentication Certification Authority,OU=Apple Worldwide Developer Relations,O=Apple Inc.,C=US crypto/x509: verify-cert rejected CN=Adobe Content Certificate 10-6,OU=Cloud Technology,O=Adobe Systems,L=San Jose,ST=California,C=US: "Cert Verify Result: CSSMERR_TP_NOT_TRUSTED" crypto/x509: verify-cert rejected CN=Adobe Intermediate CA 10-4,OU=Cloud Technology,O=Adobe Systems,L=San Jose,ST=California,C=US: "Cert Verify Result: CSSMERR_TP_NOT_TRUSTED" crypto/x509: verify-cert rejected CN=Adobe Intermediate CA 10-3,OU=Cloud Technology,O=Adobe Systems,L=San Jose,ST=California,C=US: "Cert Verify Result: CSSMERR_TP_NOT_TRUSTED" crypto/x509: verify-cert rejected CN=Adobe Content Certificate 10-5,OU=Cloud Technology,O=Adobe Systems,L=San Jose,ST=California,C=US: "Cert Verify Result: CSSMERR_TP_NOT_TRUSTED" crypto/x509: verify-cert rejected CN=Xcode Server Builder (05/11/2018\, 09:57:44): "Cert Verify Result: Invalid Extended Key Usage for policy" crypto/x509: verify-cert rejected SERIALNUMBER=IDCES-87654321K,CN=NAME REMOVED FOR PRIVACY - 87654321K,C=ES: "Cert Verify Result: Invalid Extended Key Usage for policy" crypto/x509: verify-cert rejected SERIALNUMBER=IDCES-12345678K,CN=NAME REMOVED FOR PRIVACY - 12345678K,C=ES: "Cert Verify Result: Invalid Extended Key Usage for policy" crypto/x509: verify-cert approved CN=DigiCert Global Root CA,OU=www.digicert.com,O=DigiCert Inc,C=US crypto/x509: verify-cert approved CN=Ether R3 ES Issuing CA Work,OU=Security Architecture Cryptography,O=BBVA,C=ES crypto/x509: verify-cert approved CN=DigiCert SHA2 Secure Server CA,O=DigiCert Inc,C=US crypto/x509: verify-cert approved CN=wifiaccess.grupobbva.com,OU=Comunicaciones,O=BBVA,L=Bilbao,C=ES crypto/x509: verify-cert rejected CN=vpnaas_live.es.nextgen.igrupobbva,OU=Architecture Security,O=BBVA,L=Madrid,ST=Madrid,C=ES: "Cert Verify Result: Invalid Extended Key Usage for policy" crypto/x509: verify-cert approved CN=vpnaas_live.es.nextgen.igrupobbva,OU=Security Architecture,O=BBVA,L=Madrid,ST=Madrid,C=ES crypto/x509: verify-cert approved CN=vpnaas.es.nextgen.igrupobbva,OU=Security Architecture,O=BBVA,L=Madrid,ST=Madrid,C=ES crypto/x509: verify-cert approved CN=isepsncorpeditc2.igrupobbva,O=BBVA,L=Madrid,ST=Madrid,C=ES crypto/x509: verify-cert approved CN=link.live.es.platform.bbva.com,OU=SECURITY,O=BBVA,L=MADRID,ST=MADRID,C=ES crypto/x509: verify-cert approved CN=Apple Worldwide Developer Relations Certification Authority,OU=Apple Worldwide Developer Relations,O=Apple Inc.,C=US crypto/x509: verify-cert rejected CN=armadillo.smlb.secaas-live-es.ext.es.iaas.igrupobbva,OU=Dyd,O=BBVA,L=Madrid,ST=Madrid,C=ES: "Cert Verify Result: CSSMERR_TP_NOT_TRUSTED" crypto/x509: verify-cert approved CN=Developer ID Certification Authority,OU=Apple Certification Authority,O=Apple Inc.,C=US crypto/x509: verify-cert approved CN=Developer Authentication Certification Authority,OU=Apple Worldwide Developer Relations,O=Apple Inc.,C=US crypto/x509: verify-cert rejected CN=Adobe Content Certificate 10-6,OU=Cloud Technology,O=Adobe Systems,L=San Jose,ST=California,C=US: "Cert Verify Result: CSSMERR_TP_NOT_TRUSTED" crypto/x509: verify-cert rejected CN=Adobe Intermediate CA 10-4,OU=Cloud Technology,O=Adobe Systems,L=San Jose,ST=California,C=US: "Cert Verify Result: CSSMERR_TP_NOT_TRUSTED" crypto/x509: verify-cert rejected CN=Adobe Content Certificate 10-5,OU=Cloud Technology,O=Adobe Systems,L=San Jose,ST=California,C=US: "Cert Verify Result: CSSMERR_TP_NOT_TRUSTED" crypto/x509: verify-cert rejected CN=Adobe Intermediate CA 10-3,OU=Cloud Technology,O=Adobe Systems,L=San Jose,ST=California,C=US: "Cert Verify Result: CSSMERR_TP_NOT_TRUSTED" crypto/x509: verify-cert rejected CN=Xcode Server Builder (05/11/2018\, 09:57:44): "Cert Verify Result: Invalid Extended Key Usage for policy" crypto/x509: verify-cert rejected SERIALNUMBER=IDCES-87654321K,CN=NAME REMOVED FOR PRIVACY - 87654321K,C=ES: "Cert Verify Result: Invalid Extended Key Usage for policy" crypto/x509: verify-cert rejected SERIALNUMBER=IDCES-12345678K,CN=NAME REMOVED FOR PRIVACY - 12345678K,C=ES: "Cert Verify Result: Invalid Extended Key Usage for policy" crypto/x509: verify-cert approved CN=Ether R3 ES Issuing CA Work,OU=Security Architecture Cryptography,O=BBVA,C=ES crypto/x509: ran security verify-cert 51 times cgo sys roots: 366.462356ms non-cgo sys roots: 671.314532ms signed certificate only present in non-cgo pool (acceptable): CN=Apple Worldwide Developer Relations Certification Authority,OU=Apple Worldwide Developer Relations,O=Apple Inc.,C=US signed certificate only present in non-cgo pool (acceptable): CN=DigiCert SHA2 Secure Server CA,O=DigiCert Inc,C=US signed certificate only present in non-cgo pool (acceptable): CN=wifiaccess.grupobbva.com,OU=Comunicaciones,O=BBVA,L=Bilbao,C=ES signed certificate only present in non-cgo pool (acceptable): CN=vpnaas_live.es.nextgen.igrupobbva,OU=Security Architecture,O=BBVA,L=Madrid,ST=Madrid,C=ES signed certificate only present in non-cgo pool (acceptable): CN=isepsncorpeditc2.igrupobbva,O=BBVA,L=Madrid,ST=Madrid,C=ES signed certificate only present in non-cgo pool (acceptable): CN=Developer ID Certification Authority,OU=Apple Certification Authority,O=Apple Inc.,C=US signed certificate only present in non-cgo pool (acceptable): CN=Developer Authentication Certification Authority,OU=Apple Worldwide Developer Relations,O=Apple Inc.,C=US signed certificate only present in non-cgo pool (acceptable): CN=Ether R3 ES Issuing CA Work,OU=Security Architecture Cryptography,O=BBVA,C=ES certificate only present in cgo pool: SERIALNUMBER=IDCES-87654321K,CN=NAME REMOVED FOR PRIVACY - 87654321K,C=ES certificate only present in cgo pool: CN=Xcode Server Builder (05/11/2018\, 09:57:44) certificate only present in cgo pool: CN=armadillo.smlb.secaas-live-es.ext.es.iaas.igrupobbva,OU=Dyd,O=BBVA,L=Madrid,ST=Madrid,C=ES certificate only present in cgo pool: SERIALNUMBER=IDCES-12345678K,CN=NAME REMOVED FOR PRIVACY - 12345678K,C=ES Number of trusted certs = 11 Cert 0: wifiaccess.grupobbva.com Number of trust settings : 2 Trust Setting 0: Policy OID : EAP Allowed Error : CSSMERR_TP_CERT_EXPIRED Result Type : kSecTrustSettingsResultTrustAsRoot Trust Setting 1: Policy OID : Apple X509 Basic Allowed Error : CSSMERR_TP_CERT_EXPIRED Result Type : kSecTrustSettingsResultTrustAsRoot Cert 1: vpnaas.es.nextgen.igrupobbva Number of trust settings : 10 Trust Setting 0: Policy OID : SSL Allowed Error : CSSMERR_TP_CERT_EXPIRED Result Type : kSecTrustSettingsResultTrustRoot Trust Setting 1: Policy OID : SSL Allowed Error : Host name mismatch Result Type : kSecTrustSettingsResultTrustRoot Trust Setting 2: Policy OID : SMIME Allowed Error : CSSMERR_TP_CERT_EXPIRED Result Type : kSecTrustSettingsResultTrustRoot Trust Setting 3: Policy OID : SMIME Allowed Error : S/MIME Email address mismatch Result Type : kSecTrustSettingsResultTrustRoot Trust Setting 4: Policy OID : EAP Allowed Error : CSSMERR_TP_CERT_EXPIRED Result Type : kSecTrustSettingsResultTrustRoot Trust Setting 5: Policy OID : IPSec Allowed Error : CSSMERR_TP_CERT_EXPIRED Result Type : kSecTrustSettingsResultTrustRoot Trust Setting 6: Policy OID : Code Signing Allowed Error : CSSMERR_TP_CERT_EXPIRED Result Type : kSecTrustSettingsResultTrustRoot Trust Setting 7: Policy OID : Unknown OID length 9, value { 2A 86 48 86 F7 63 64 01 14 } Allowed Error : CSSMERR_TP_CERT_EXPIRED Result Type : kSecTrustSettingsResultTrustRoot Trust Setting 8: Policy OID : Apple X509 Basic Allowed Error : CSSMERR_TP_CERT_EXPIRED Result Type : kSecTrustSettingsResultTrustRoot Trust Setting 9: Allowed Error : CSSMERR_TP_CERT_EXPIRED Result Type : kSecTrustSettingsResultTrustRoot Cert 2: isepsncorpeditc2.igrupobbva Number of trust settings : 2 Trust Setting 0: Policy OID : EAP Allowed Error : CSSMERR_TP_CERT_EXPIRED Result Type : kSecTrustSettingsResultTrustAsRoot Trust Setting 1: Policy OID : Apple X509 Basic Allowed Error : CSSMERR_TP_CERT_EXPIRED Result Type : kSecTrustSettingsResultTrustAsRoot Cert 3: link.live.es.platform.bbva.com Number of trust settings : 3 Trust Setting 0: Policy OID : SSL Policy String : 185.24.6.15 Allowed Error : CSSMERR_TP_CERT_EXPIRED Result Type : kSecTrustSettingsResultTrustAsRoot Trust Setting 1: Policy OID : SSL Policy String : 185.24.6.15 Allowed Error : Host name mismatch Result Type : kSecTrustSettingsResultTrustAsRoot Trust Setting 2: Policy OID : Apple X509 Basic Policy String : 185.24.6.15 Allowed Error : CSSMERR_TP_CERT_EXPIRED Result Type : kSecTrustSettingsResultTrustAsRoot Cert 4: armadillo.smlb.secaas-live-es.ext.es.iaas.igrupobbva Number of trust settings : 2 Trust Setting 0: Policy OID : SSL Policy String : atenea.live.global.ether.igrupobbva Allowed Error : CSSMERR_TP_CERT_EXPIRED Result Type : kSecTrustSettingsResultTrustRoot Trust Setting 1: Policy OID : SSL Policy String : atenea.live.global.ether.igrupobbva Allowed Error : Host name mismatch Result Type : kSecTrustSettingsResultTrustRoot Cert 5: Xcode Server Builder (05/11/2018, 09:57:44) Number of trust settings : 9 Trust Setting 0: Policy OID : SSL Allowed Error : CSSMERR_TP_CERT_EXPIRED Result Type : kSecTrustSettingsResultTrustAsRoot Trust Setting 1: Policy OID : SSL Allowed Error : Host name mismatch Result Type : kSecTrustSettingsResultTrustAsRoot Trust Setting 2: Policy OID : SMIME Allowed Error : CSSMERR_TP_CERT_EXPIRED Result Type : kSecTrustSettingsResultTrustAsRoot Trust Setting 3: Policy OID : SMIME Allowed Error : S/MIME Email address mismatch Result Type : kSecTrustSettingsResultTrustAsRoot Trust Setting 4: Policy OID : EAP Allowed Error : CSSMERR_TP_CERT_EXPIRED Result Type : kSecTrustSettingsResultTrustAsRoot Trust Setting 5: Policy OID : IPSec Allowed Error : CSSMERR_TP_CERT_EXPIRED Result Type : kSecTrustSettingsResultTrustAsRoot Trust Setting 6: Policy OID : Code Signing Allowed Error : CSSMERR_TP_CERT_EXPIRED Result Type : kSecTrustSettingsResultTrustAsRoot Trust Setting 7: Policy OID : Unknown OID length 9, value { 2A 86 48 86 F7 63 64 01 14 } Allowed Error : CSSMERR_TP_CERT_EXPIRED Result Type : kSecTrustSettingsResultTrustAsRoot Trust Setting 8: Policy OID : Apple X509 Basic Allowed Error : CSSMERR_TP_CERT_EXPIRED Result Type : kSecTrustSettingsResultTrustAsRoot Cert 6: NAME REMOVED FOR PRIVACY - 87654321K Number of trust settings : 9 Trust Setting 0: Policy OID : SSL Allowed Error : CSSMERR_TP_CERT_EXPIRED Result Type : kSecTrustSettingsResultTrustAsRoot Trust Setting 1: Policy OID : SSL Allowed Error : Host name mismatch Result Type : kSecTrustSettingsResultTrustAsRoot Trust Setting 2: Policy OID : SMIME Allowed Error : CSSMERR_TP_CERT_EXPIRED Result Type : kSecTrustSettingsResultTrustAsRoot Trust Setting 3: Policy OID : SMIME Allowed Error : S/MIME Email address mismatch Result Type : kSecTrustSettingsResultTrustAsRoot Trust Setting 4: Policy OID : EAP Allowed Error : CSSMERR_TP_CERT_EXPIRED Result Type : kSecTrustSettingsResultTrustAsRoot Trust Setting 5: Policy OID : IPSec Allowed Error : CSSMERR_TP_CERT_EXPIRED Result Type : kSecTrustSettingsResultTrustAsRoot Trust Setting 6: Policy OID : Code Signing Allowed Error : CSSMERR_TP_CERT_EXPIRED Result Type : kSecTrustSettingsResultTrustAsRoot Trust Setting 7: Policy OID : Unknown OID length 9, value { 2A 86 48 86 F7 63 64 01 14 } Allowed Error : CSSMERR_TP_CERT_EXPIRED Result Type : kSecTrustSettingsResultTrustAsRoot Trust Setting 8: Policy OID : Apple X509 Basic Allowed Error : CSSMERR_TP_CERT_EXPIRED Result Type : kSecTrustSettingsResultTrustAsRoot Cert 7: NAME REMOVED FOR PRIVACY - 12345678K Number of trust settings : 9 Trust Setting 0: Policy OID : SSL Allowed Error : CSSMERR_TP_CERT_EXPIRED Result Type : kSecTrustSettingsResultTrustAsRoot Trust Setting 1: Policy OID : SSL Allowed Error : Host name mismatch Result Type : kSecTrustSettingsResultTrustAsRoot Trust Setting 2: Policy OID : SMIME Allowed Error : CSSMERR_TP_CERT_EXPIRED Result Type : kSecTrustSettingsResultTrustAsRoot Trust Setting 3: Policy OID : SMIME Allowed Error : S/MIME Email address mismatch Result Type : kSecTrustSettingsResultTrustAsRoot Trust Setting 4: Policy OID : EAP Allowed Error : CSSMERR_TP_CERT_EXPIRED Result Type : kSecTrustSettingsResultTrustAsRoot Trust Setting 5: Policy OID : IPSec Allowed Error : CSSMERR_TP_CERT_EXPIRED Result Type : kSecTrustSettingsResultTrustAsRoot Trust Setting 6: Policy OID : Code Signing Allowed Error : CSSMERR_TP_CERT_EXPIRED Result Type : kSecTrustSettingsResultTrustAsRoot Trust Setting 7: Policy OID : Unknown OID length 9, value { 2A 86 48 86 F7 63 64 01 14 } Allowed Error : CSSMERR_TP_CERT_EXPIRED Result Type : kSecTrustSettingsResultTrustAsRoot Trust Setting 8: Policy OID : Apple X509 Basic Allowed Error : CSSMERR_TP_CERT_EXPIRED Result Type : kSecTrustSettingsResultTrustAsRoot Cert 8: BBVA Autoridad de Certificacion Digital Number of trust settings : 10 Trust Setting 0: Policy OID : SSL Allowed Error : CSSMERR_TP_CERT_EXPIRED Result Type : kSecTrustSettingsResultTrustRoot Trust Setting 1: Policy OID : SSL Allowed Error : Host name mismatch Result Type : kSecTrustSettingsResultTrustRoot Trust Setting 2: Policy OID : SMIME Allowed Error : CSSMERR_TP_CERT_EXPIRED Result Type : kSecTrustSettingsResultTrustRoot Trust Setting 3: Policy OID : SMIME Allowed Error : S/MIME Email address mismatch Result Type : kSecTrustSettingsResultTrustRoot Trust Setting 4: Policy OID : EAP Allowed Error : CSSMERR_TP_CERT_EXPIRED Result Type : kSecTrustSettingsResultTrustRoot Trust Setting 5: Policy OID : IPSec Allowed Error : CSSMERR_TP_CERT_EXPIRED Result Type : kSecTrustSettingsResultTrustRoot Trust Setting 6: Policy OID : Code Signing Allowed Error : CSSMERR_TP_CERT_EXPIRED Result Type : kSecTrustSettingsResultTrustRoot Trust Setting 7: Policy OID : Unknown OID length 9, value { 2A 86 48 86 F7 63 64 01 14 } Allowed Error : CSSMERR_TP_CERT_EXPIRED Result Type : kSecTrustSettingsResultTrustRoot Trust Setting 8: Policy OID : Apple X509 Basic Allowed Error : CSSMERR_TP_CERT_EXPIRED Result Type : kSecTrustSettingsResultTrustRoot Trust Setting 9: Allowed Error : CSSMERR_TP_CERT_EXPIRED Result Type : kSecTrustSettingsResultTrustRoot Cert 9: BBVA CA Raiz Number of trust settings : 10 Trust Setting 0: Policy OID : SSL Allowed Error : CSSMERR_TP_CERT_EXPIRED Result Type : kSecTrustSettingsResultTrustRoot Trust Setting 1: Policy OID : SSL Allowed Error : Host name mismatch Result Type : kSecTrustSettingsResultTrustRoot Trust Setting 2: Policy OID : SMIME Allowed Error : CSSMERR_TP_CERT_EXPIRED Result Type : kSecTrustSettingsResultTrustRoot Trust Setting 3: Policy OID : SMIME Allowed Error : S/MIME Email address mismatch Result Type : kSecTrustSettingsResultTrustRoot Trust Setting 4: Policy OID : EAP Allowed Error : CSSMERR_TP_CERT_EXPIRED Result Type : kSecTrustSettingsResultTrustRoot Trust Setting 5: Policy OID : IPSec Allowed Error : CSSMERR_TP_CERT_EXPIRED Result Type : kSecTrustSettingsResultTrustRoot Trust Setting 6: Policy OID : Code Signing Allowed Error : CSSMERR_TP_CERT_EXPIRED Result Type : kSecTrustSettingsResultTrustRoot Trust Setting 7: Policy OID : Unknown OID length 9, value { 2A 86 48 86 F7 63 64 01 14 } Allowed Error : CSSMERR_TP_CERT_EXPIRED Result Type : kSecTrustSettingsResultTrustRoot Trust Setting 8: Policy OID : Apple X509 Basic Allowed Error : CSSMERR_TP_CERT_EXPIRED Result Type : kSecTrustSettingsResultTrustRoot Trust Setting 9: Allowed Error : CSSMERR_TP_CERT_EXPIRED Result Type : kSecTrustSettingsResultTrustRoot Cert 10: Global Root CA Work Number of trust settings : 10 Trust Setting 0: Policy OID : SSL Allowed Error : CSSMERR_TP_CERT_EXPIRED Result Type : kSecTrustSettingsResultTrustRoot Trust Setting 1: Policy OID : SSL Allowed Error : Host name mismatch Result Type : kSecTrustSettingsResultTrustRoot Trust Setting 2: Policy OID : SMIME Allowed Error : CSSMERR_TP_CERT_EXPIRED Result Type : kSecTrustSettingsResultTrustRoot Trust Setting 3: Policy OID : SMIME Allowed Error : S/MIME Email address mismatch Result Type : kSecTrustSettingsResultTrustRoot Trust Setting 4: Policy OID : EAP Allowed Error : CSSMERR_TP_CERT_EXPIRED Result Type : kSecTrustSettingsResultTrustRoot Trust Setting 5: Policy OID : IPSec Allowed Error : CSSMERR_TP_CERT_EXPIRED Result Type : kSecTrustSettingsResultTrustRoot Trust Setting 6: Policy OID : Code Signing Allowed Error : CSSMERR_TP_CERT_EXPIRED Result Type : kSecTrustSettingsResultTrustRoot Trust Setting 7: Policy OID : Unknown OID length 9, value { 2A 86 48 86 F7 63 64 01 14 } Allowed Error : CSSMERR_TP_CERT_EXPIRED Result Type : kSecTrustSettingsResultTrustRoot Trust Setting 8: Policy OID : Apple X509 Basic Allowed Error : CSSMERR_TP_CERT_EXPIRED Result Type : kSecTrustSettingsResultTrustRoot Trust Setting 9: Allowed Error : CSSMERR_TP_CERT_EXPIRED Result Type : kSecTrustSettingsResultTrustRoot Number of trusted certs = 5 Cert 0: AutoFirma ROOT Number of trust settings : 10 Trust Setting 0: Policy OID : SSL Allowed Error : CSSMERR_TP_CERT_EXPIRED Result Type : kSecTrustSettingsResultTrustRoot Trust Setting 1: Policy OID : SSL Allowed Error : Host name mismatch Result Type : kSecTrustSettingsResultTrustRoot Trust Setting 2: Policy OID : SMIME Allowed Error : CSSMERR_TP_CERT_EXPIRED Result Type : kSecTrustSettingsResultTrustRoot Trust Setting 3: Policy OID : SMIME Allowed Error : S/MIME Email address mismatch Result Type : kSecTrustSettingsResultTrustRoot Trust Setting 4: Policy OID : EAP Allowed Error : CSSMERR_TP_CERT_EXPIRED Result Type : kSecTrustSettingsResultTrustRoot Trust Setting 5: Policy OID : IPSec Allowed Error : CSSMERR_TP_CERT_EXPIRED Result Type : kSecTrustSettingsResultTrustRoot Trust Setting 6: Policy OID : Code Signing Allowed Error : CSSMERR_TP_CERT_EXPIRED Result Type : kSecTrustSettingsResultTrustRoot Trust Setting 7: Policy OID : Unknown OID length 9, value { 2A 86 48 86 F7 63 64 01 14 } Allowed Error : CSSMERR_TP_CERT_EXPIRED Result Type : kSecTrustSettingsResultTrustRoot Trust Setting 8: Policy OID : Apple X509 Basic Allowed Error : CSSMERR_TP_CERT_EXPIRED Result Type : kSecTrustSettingsResultTrustRoot Trust Setting 9: Allowed Error : CSSMERR_TP_CERT_EXPIRED Result Type : kSecTrustSettingsResultTrustRoot Cert 1: 127.0.0.1 Number of trust settings : 9 Trust Setting 0: Policy OID : SSL Allowed Error : CSSMERR_TP_CERT_EXPIRED Result Type : kSecTrustSettingsResultTrustAsRoot Trust Setting 1: Policy OID : SSL Allowed Error : Host name mismatch Result Type : kSecTrustSettingsResultTrustAsRoot Trust Setting 2: Policy OID : SMIME Allowed Error : CSSMERR_TP_CERT_EXPIRED Result Type : kSecTrustSettingsResultTrustAsRoot Trust Setting 3: Policy OID : SMIME Allowed Error : S/MIME Email address mismatch Result Type : kSecTrustSettingsResultTrustAsRoot Trust Setting 4: Policy OID : EAP Allowed Error : CSSMERR_TP_CERT_EXPIRED Result Type : kSecTrustSettingsResultTrustAsRoot Trust Setting 5: Policy OID : IPSec Allowed Error : CSSMERR_TP_CERT_EXPIRED Result Type : kSecTrustSettingsResultTrustAsRoot Trust Setting 6: Policy OID : Code Signing Allowed Error : CSSMERR_TP_CERT_EXPIRED Result Type : kSecTrustSettingsResultTrustAsRoot Trust Setting 7: Policy OID : Unknown OID length 9, value { 2A 86 48 86 F7 63 64 01 14 } Allowed Error : CSSMERR_TP_CERT_EXPIRED Result Type : kSecTrustSettingsResultTrustAsRoot Trust Setting 8: Policy OID : Apple X509 Basic Allowed Error : CSSMERR_TP_CERT_EXPIRED Result Type : kSecTrustSettingsResultTrustAsRoot Cert 2: BBVA CA Servidores Number of trust settings : 10 Trust Setting 0: Policy OID : SSL Allowed Error : CSSMERR_TP_CERT_EXPIRED Result Type : kSecTrustSettingsResultTrustAsRoot Trust Setting 1: Policy OID : SSL Allowed Error : Host name mismatch Result Type : kSecTrustSettingsResultTrustAsRoot Trust Setting 2: Policy OID : SMIME Allowed Error : CSSMERR_TP_CERT_EXPIRED Result Type : kSecTrustSettingsResultTrustAsRoot Trust Setting 3: Policy OID : SMIME Allowed Error : S/MIME Email address mismatch Result Type : kSecTrustSettingsResultTrustAsRoot Trust Setting 4: Policy OID : EAP Allowed Error : CSSMERR_TP_CERT_EXPIRED Result Type : kSecTrustSettingsResultTrustAsRoot Trust Setting 5: Policy OID : IPSec Allowed Error : CSSMERR_TP_CERT_EXPIRED Result Type : kSecTrustSettingsResultTrustAsRoot Trust Setting 6: Policy OID : Code Signing Allowed Error : CSSMERR_TP_CERT_EXPIRED Result Type : kSecTrustSettingsResultTrustAsRoot Trust Setting 7: Policy OID : Unknown OID length 9, value { 2A 86 48 86 F7 63 64 01 14 } Allowed Error : CSSMERR_TP_CERT_EXPIRED Result Type : kSecTrustSettingsResultTrustAsRoot Trust Setting 8: Policy OID : Apple X509 Basic Allowed Error : CSSMERR_TP_CERT_EXPIRED Result Type : kSecTrustSettingsResultTrustAsRoot Trust Setting 9: Allowed Error : CSSMERR_TP_CERT_EXPIRED Result Type : kSecTrustSettingsResultTrustAsRoot Cert 3: BBVA Servidores Autoridad de Certificacion Digital Number of trust settings : 10 Trust Setting 0: Policy OID : SSL Allowed Error : CSSMERR_TP_CERT_EXPIRED Result Type : kSecTrustSettingsResultTrustAsRoot Trust Setting 1: Policy OID : SSL Allowed Error : Host name mismatch Result Type : kSecTrustSettingsResultTrustAsRoot Trust Setting 2: Policy OID : SMIME Allowed Error : CSSMERR_TP_CERT_EXPIRED Result Type : kSecTrustSettingsResultTrustAsRoot Trust Setting 3: Policy OID : SMIME Allowed Error : S/MIME Email address mismatch Result Type : kSecTrustSettingsResultTrustAsRoot Trust Setting 4: Policy OID : EAP Allowed Error : CSSMERR_TP_CERT_EXPIRED Result Type : kSecTrustSettingsResultTrustAsRoot Trust Setting 5: Policy OID : IPSec Allowed Error : CSSMERR_TP_CERT_EXPIRED Result Type : kSecTrustSettingsResultTrustAsRoot Trust Setting 6: Policy OID : Code Signing Allowed Error : CSSMERR_TP_CERT_EXPIRED Result Type : kSecTrustSettingsResultTrustAsRoot Trust Setting 7: Policy OID : Unknown OID length 9, value { 2A 86 48 86 F7 63 64 01 14 } Allowed Error : CSSMERR_TP_CERT_EXPIRED Result Type : kSecTrustSettingsResultTrustAsRoot Trust Setting 8: Policy OID : Apple X509 Basic Allowed Error : CSSMERR_TP_CERT_EXPIRED Result Type : kSecTrustSettingsResultTrustAsRoot Trust Setting 9: Allowed Error : CSSMERR_TP_CERT_EXPIRED Result Type : kSecTrustSettingsResultTrustAsRoot Cert 4: Global Root CA Number of trust settings : 0 |
It did not work for me unfortunately, although the trust settings are now printed by @FiloSottile test: Test resultsCert 4: Global Root CA Number of trust settings : 10 Trust Setting 0: Policy OID : SSL Allowed Error : CSSMERR_TP_CERT_EXPIRED Result Type : kSecTrustSettingsResultTrustRoot Trust Setting 1: Policy OID : SSL Allowed Error : Host name mismatch Result Type : kSecTrustSettingsResultTrustRoot Trust Setting 2: Policy OID : Code Signing Allowed Error : CSSMERR_TP_CERT_EXPIRED Result Type : kSecTrustSettingsResultTrustRoot Trust Setting 3: Policy OID : Unknown OID length 9, value { 2A 86 48 86 F7 63 64 01 14 } Allowed Error : CSSMERR_TP_CERT_EXPIRED Result Type : kSecTrustSettingsResultTrustRoot Trust Setting 4: Policy OID : Apple X509 Basic Allowed Error : CSSMERR_TP_CERT_EXPIRED Result Type : kSecTrustSettingsResultTrustRoot Trust Setting 5: Policy OID : SMIME Allowed Error : CSSMERR_TP_CERT_EXPIRED Result Type : kSecTrustSettingsResultTrustRoot Trust Setting 6: Policy OID : SMIME Allowed Error : S/MIME Email address mismatch Result Type : kSecTrustSettingsResultTrustRoot Trust Setting 7: Policy OID : EAP Allowed Error : CSSMERR_TP_CERT_EXPIRED Result Type : kSecTrustSettingsResultTrustRoot Trust Setting 8: Policy OID : IPSec Allowed Error : CSSMERR_TP_CERT_EXPIRED Result Type : kSecTrustSettingsResultTrustRoot Trust Setting 9: Allowed Error : CSSMERR_TP_CERT_EXPIRED Result Type : kSecTrustSettingsResultTrustRoot |
The cgo path was not taking policies into account, using the last security setting in the array whatever it was. Also, it was not aware of the defaults for empty security settings, and for security settings without a result type. Finally, certificates restricted to a hostname were considered roots. The API docs for this code are partial and not very clear, so this is a best effort, really. Updates #24652 Change-Id: I8fa2fe4706f44f3d963b32e0615d149e997b537d Reviewed-on: https://go-review.googlesource.com/c/128056 Run-TryBot: Filippo Valsorda <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Adam Langley <[email protected]> Reviewed-by: Adam Langley <[email protected]>
Certificates without any trust settings might still be in the keychain (for example if they used to have some, or if they are intermediates for offline verification), but they are not to be trusted. The only ones we can trust unconditionally are the ones in the system roots store. Moreover, the verify-cert invocation was not specifying the ssl policy, defaulting instead to the basic one. We have no way of communicating different usages in a CertPool, so stick to the WebPKI use-case as the primary one for crypto/x509. Updates #24652 Change-Id: Ife8b3d2f4026daa1223aa81fac44aeeb4f96528a Reviewed-on: https://go-review.googlesource.com/c/128116 Reviewed-by: Adam Langley <[email protected]> Reviewed-by: Adam Langley <[email protected]>
Same error with go 1.11.3 😠 |
This issue should now be fixed in master, but more testing would be appreciated before we backport it, in particular by anyone who had the self-contained test fail. You can use our ✨ new golang.org/dl/gotip tool ✨ to easily test the development branch:
You can also use /cc @cvigo @dichque @wdec @adamrothman @calmh @dadrian @vdemario |
Mmmmm it does not look good...
CA is GODEBUG=x509roots=1 go test -v -run TestSystemRoots crypto/x509❯ GODEBUG=x509roots=1 go test -v -run TestSystemRoots crypto/x509 === RUN TestSystemRoots --- SKIP: TestSystemRoots (0.00s) root_darwin_test.go:21: skipping on darwin/amd64 until golang.org/issue/24652 has been resolved. PASS ok crypto/x509 0.012s GODEBUG=x509roots=1 gotip test -v -run TestSystemRoots crypto/x509❯ GODEBUG=x509roots=1 gotip test -v -run TestSystemRoots crypto/x509 === RUN TestSystemRoots crypto/x509: 16 certs have a trust policy crypto/x509: verify-cert approved CN=mycompanyname CA Raiz,O=mycompanyname crypto/x509: verify-cert approved CN=mycompanyname Autoridad de Certificacion Digital,O=My Company Name crypto/x509: verify-cert approved CN=127.0.0.1 crypto/x509: verify-cert approved CN=AutoFirma ROOT crypto/x509: verify-cert approved CN=mycompanyname CA Servidores,O=mycompanyname crypto/x509: verify-cert approved CN=mycompanyname Servidores Autoridad de Certificacion Digital,OU=Para Uso Interno mycompanyname,O=My Company Name crypto/x509: verify-cert approved CN=Global Root CA Work,OU=Security Architecture Cryptography,O=mycompanyname,C=ES crypto/x509: verify-cert approved CN=Global Root CA,OU=Security Architecture Cryptography,O=mycompanyname,C=ES crypto/x509: verify-cert approved CN=wifiaccess.mycompanyname.com,OU=Comunicaciones,O=mycompanyname,L=Bilbao,C=ES crypto/x509: verify-cert approved CN=isepsncorpeditc2.imycompanyname,O=mycompanyname,L=Madrid,ST=Madrid,C=ES crypto/x509: verify-cert approved CN=link.live.es.platform.mycompanyname.com,OU=SECURITY,O=mycompanyname,L=MADRID,ST=MADRID,C=ES crypto/x509: verify-cert rejected CN=Xcode Server Builder (05/11/2018\, 09:57:44): "Cert Verify Result: Invalid Extended Key Usage for policy" crypto/x509: verify-cert approved CN=vpnaas.es.datacenter.imycompanyname,OU=Security Architecture,O=mycompanyname,L=Madrid,ST=Madrid,C=ES crypto/x509: verify-cert rejected CN=armadillo.smlb.secaas-live-es.ext.es.iaas.imycompanyname,OU=Dyd,O=mycompanyname,L=Madrid,ST=Madrid,C=ES: "Cert Verify Result: CSSMERR_TP_NOT_TRUSTED" crypto/x509: verify-cert approved CN=Global Root CA Work,OU=Security Architecture Cryptography,O=mycompanyname,C=ES crypto/x509: verify-cert approved CN=wifiaccess.mycompanyname.com,OU=Comunicaciones,O=mycompanyname,L=Bilbao,C=ES crypto/x509: verify-cert approved CN=vpnaas.es.datacenter.imycompanyname,OU=Security Architecture,O=mycompanyname,L=Madrid,ST=Madrid,C=ES crypto/x509: verify-cert approved CN=isepsncorpeditc2.imycompanyname,O=mycompanyname,L=Madrid,ST=Madrid,C=ES crypto/x509: verify-cert approved CN=link.live.es.platform.mycompanyname.com,OU=SECURITY,O=mycompanyname,L=MADRID,ST=MADRID,C=ES crypto/x509: verify-cert rejected CN=armadillo.smlb.secaas-live-es.ext.es.iaas.imycompanyname,OU=Dyd,O=mycompanyname,L=Madrid,ST=Madrid,C=ES: "Cert Verify Result: CSSMERR_TP_NOT_TRUSTED" crypto/x509: verify-cert rejected CN=Xcode Server Builder (05/11/2018\, 09:57:44): "Cert Verify Result: Invalid Extended Key Usage for policy" crypto/x509: verify-cert rejected SERIALNUMBER=IDCES-XXXXXXXXX,CN=CN1 REMOVED FOR PRIVACY - XXXXXXXXX,C=ES: "Cert Verify Result: Invalid Extended Key Usage for policy" crypto/x509: verify-cert rejected SERIALNUMBER=IDCES-XXXXXXXXX,CN=CN2 REMOVED FOR PRIVACY - XXXXXXXXX,C=ES: "Cert Verify Result: Invalid Extended Key Usage for policy" crypto/x509: verify-cert rejected SERIALNUMBER=IDCES-XXXXXXXXX,CN=CN1 REMOVED FOR PRIVACY - XXXXXXXXX,C=ES: "Cert Verify Result: Invalid Extended Key Usage for policy" crypto/x509: verify-cert approved CN=Global Root CA Work,OU=Security Architecture Cryptography,O=mycompanyname,C=ES crypto/x509: verify-cert rejected SERIALNUMBER=IDCES-XXXXXXXXX,CN=CN2 REMOVED FOR PRIVACY - XXXXXXXXX,C=ES: "Cert Verify Result: Invalid Extended Key Usage for policy" crypto/x509: ran security verify-cert 26 times --- PASS: TestSystemRoots (0.94s) root_darwin_test.go:34: cgo sys roots: 197.258052ms root_darwin_test.go:35: non-cgo sys roots: 698.610683ms root_darwin_test.go:76: signed certificate only present in non-cgo pool (acceptable): CN=wifiaccess.mycompanyname.com,OU=Comunicaciones,O=mycompanyname,L=Bilbao,C=ES root_darwin_test.go:76: signed certificate only present in non-cgo pool (acceptable): CN=isepsncorpeditc2.imycompanyname,O=mycompanyname,L=Madrid,ST=Madrid,C=ES root_darwin_test.go:76: signed certificate only present in non-cgo pool (acceptable): CN=link.live.es.platform.mycompanyname.com,OU=SECURITY,O=mycompanyname,L=MADRID,ST=MADRID,C=ES root_darwin_test.go:76: signed certificate only present in non-cgo pool (acceptable): CN=Developer ID Certification Authority,OU=Apple Certification Authority,O=Apple Inc.,C=US root_darwin_test.go:96: off-EKU certificate only present in cgo pool (acceptable): SERIALNUMBER=IDCES-XXXXXXXXX,CN=CN1 REMOVED FOR PRIVACY - XXXXXXXXX,C=ES root_darwin_test.go:96: off-EKU certificate only present in cgo pool (acceptable): SERIALNUMBER=IDCES-XXXXXXXXX,CN=CN2 REMOVED FOR PRIVACY - XXXXXXXXX,C=ES root_darwin_test.go:96: off-EKU certificate only present in cgo pool (acceptable): CN=Xcode Server Builder (05/11/2018\, 09:57:44) PASS crypto/x509: kSecTrustSettingsResultInvalid = 0 crypto/x509: kSecTrustSettingsResultTrustRoot = 1 crypto/x509: kSecTrustSettingsResultTrustAsRoot = 2 crypto/x509: kSecTrustSettingsResultDeny = 3 crypto/x509: kSecTrustSettingsResultUnspecified = 4 crypto/x509: AutoFirma ROOT returned 1 crypto/x509: 127.0.0.1 returned 2 crypto/x509: mycompanyname CA Servidores returned 2 crypto/x509: mycompanyname Servidores Autoridad de Certificacion Digital returned 2 crypto/x509: Global Root CA returned 1 crypto/x509: wifiaccess.mycompanyname.com returned 4 crypto/x509: vpnaas.es.datacenter.imycompanyname returned 1 crypto/x509: isepsncorpeditc2.imycompanyname returned 4 crypto/x509: link.live.es.platform.mycompanyname.com returned 4 crypto/x509: armadillo.smlb.secaas-live-es.ext.es.iaas.imycompanyname returned 4 crypto/x509: Xcode Server Builder (05/11/2018, 09:57:44) returned 2 crypto/x509: CN2 REMOVED FOR PRIVACY - XXXXXXXXX returned 2 crypto/x509: CN1 REMOVED FOR PRIVACY - XXXXXXXXX returned 2 crypto/x509: Global Root CA Work returned 1 crypto/x509: mycompanyname Autoridad de Certificacion Digital returned 1 crypto/x509: mycompanyname CA Raiz returned 1 ok crypto/x509 (cached) go get -v -u scm.es.datacenter.imycompanyname/connectors/titan_sql_protobuf (FAIL)❯ GODEBUG=1 go get -v -u scm.es.datacenter.imycompanyname/connectors/titan_sql_protobuf Fetching https://scm.es.datacenter.imycompanyname/connectors/titan_sql_protobuf?go-get=1 https fetch failed: Get https://scm.es.datacenter.imycompanyname/connectors/titan_sql_protobuf?go-get=1: x509: certificate signed by unknown authority Fetching https://scm.es.datacenter.imycompanyname/connectors?go-get=1 https fetch failed: Get https://scm.es.datacenter.imycompanyname/connectors?go-get=1: x509: certificate signed by unknown authority Fetching https://scm.es.datacenter.imycompanyname?go-get=1 https fetch failed: Get https://scm.es.datacenter.imycompanyname?go-get=1: x509: certificate signed by unknown authority go get scm.es.datacenter.imycompanyname/connectors/titan_sql_protobuf: unrecognized import path "scm.es.datacenter.imycompanyname/connectors/titan_sql_protobuf" (https fetch: Get https://scm.es.datacenter.imycompanyname/connectors/titan_sql_protobuf?go-get=1: x509: certificate signed by unknown authority) gotip get -v -u scm.es.datacenter.imycompanyname/connectors/titan_sql_protobuf (also FAIL)❯ GODEBUG=x509roots=1 gotip get -v -u scm.es.datacenter.imycompanyname/connectors/titan_sql_protobuf Fetching https://scm.es.datacenter.imycompanyname/connectors/titan_sql_protobuf?go-get=1 crypto/x509: kSecTrustSettingsResultInvalid = 0 crypto/x509: kSecTrustSettingsResultTrustRoot = 1 crypto/x509: kSecTrustSettingsResultTrustAsRoot = 2 crypto/x509: kSecTrustSettingsResultDeny = 3 crypto/x509: kSecTrustSettingsResultUnspecified = 4 crypto/x509: AutoFirma ROOT returned 1 crypto/x509: 127.0.0.1 returned 2 crypto/x509: mycompanyname CA Servidores returned 2 crypto/x509: mycompanyname Servidores Autoridad de Certificacion Digital returned 2 crypto/x509: Global Root CA returned 1 crypto/x509: wifiaccess.mycompanyname.com returned 4 crypto/x509: vpnaas.es.datacenter.imycompanyname returned 1 crypto/x509: isepsncorpeditc2.imycompanyname returned 4 crypto/x509: link.live.es.platform.mycompanyname.com returned 4 crypto/x509: armadillo.smlb.secaas-live-es.ext.es.iaas.imycompanyname returned 4 crypto/x509: Xcode Server Builder (05/11/2018, 09:57:44) returned 2 crypto/x509: CN2 REMOVED FOR PRIVACY - XXXXXXXXX returned 2 crypto/x509: CN1 REMOVED FOR PRIVACY - XXXXXXXXX returned 2 crypto/x509: Global Root CA Work returned 1 crypto/x509: mycompanyname Autoridad de Certificacion Digital returned 1 crypto/x509: mycompanyname CA Raiz returned 1 https fetch failed: Get https://scm.es.datacenter.imycompanyname/connectors/titan_sql_protobuf?go-get=1: x509: certificate signed by unknown authority Fetching https://scm.es.datacenter.imycompanyname/connectors?go-get=1 https fetch failed: Get https://scm.es.datacenter.imycompanyname/connectors?go-get=1: x509: certificate signed by unknown authority Fetching https://scm.es.datacenter.imycompanyname?go-get=1 https fetch failed: Get https://scm.es.datacenter.imycompanyname?go-get=1: x509: certificate signed by unknown authority go get scm.es.datacenter.imycompanyname/connectors/titan_sql_protobuf: unrecognized import path "scm.es.datacenter.imycompanyname/connectors/titan_sql_protobuf" (https fetch: Get https://scm.es.datacenter.imycompanyname/connectors/titan_sql_protobuf?go-get=1: x509: certificate signed by unknown authority) |
@FiloSottile tests passed for me. $ GODEBUG=x509roots=1 gotip test -v -run TestSystemRoots crypto/x509
=== RUN TestSystemRoots
crypto/x509: 3 certs have a trust policy
crypto/x509: verify-cert approved CN=X Proto CA,OU=0x21,O=University of Michigan,L=Ann Arbor,ST=Michigan,C=US
crypto/x509: verify-cert approved CN=radius.umnet.umich.edu,OU=Information Technology Services,O=University of Michigan,POSTALCODE=48105-3640,L=Ann Arbor,ST=MI,C=US
crypto/x509: verify-cert rejected CN=dlv-cert: "Cert Verify Result: Invalid Extended Key Usage for policy"
crypto/x509: verify-cert approved CN=radius.umnet.umich.edu,OU=Information Technology Services,O=University of Michigan,POSTALCODE=48105-3640,L=Ann Arbor,ST=MI,C=US
crypto/x509: ran security verify-cert 4 times
--- PASS: TestSystemRoots (0.63s)
root_darwin_test.go:34: cgo sys roots: 315.417942ms
root_darwin_test.go:35: non-cgo sys roots: 245.18544ms
root_darwin_test.go:76: signed certificate only present in non-cgo pool (acceptable): CN=radius.umnet.umich.edu,OU=Information Technology Services,O=University of Michigan,POSTALCODE=48105-3640,L=Ann Arbor,ST=MI,C=US
root_darwin_test.go:76: signed certificate only present in non-cgo pool (acceptable): CN=Developer ID Certification Authority,OU=Apple Certification Authority,O=Apple Inc.,C=US
root_darwin_test.go:96: off-EKU certificate only present in cgo pool (acceptable): CN=dlv-cert
PASS
crypto/x509: kSecTrustSettingsResultInvalid = 0
crypto/x509: kSecTrustSettingsResultTrustRoot = 1
crypto/x509: kSecTrustSettingsResultTrustAsRoot = 2
crypto/x509: kSecTrustSettingsResultDeny = 3
crypto/x509: kSecTrustSettingsResultUnspecified = 4
crypto/x509: dlv-cert returned 1
crypto/x509: X Proto CA returned 1
crypto/x509: radius.umnet.umich.edu returned 4
ok crypto/x509 0.648s |
@cvigo Hmm, that's weird because the tests pass, suggesting cgo and non-cgo agree, and the debug output suggests "Global Root CA" was added to the pool. Is the chain well-formed, with all the necessary intermediates? |
It is indeed supposed to be inherited, so that's not intended behavior, if the server sends a full chain including the intermediate. There might also be something about the root CA that makes it disqualified from forming chains, if you can share it at [email protected] I can look into that. |
Done, thanks!! |
@FiloSottile failed
|
Latest tip (commit 99ea99e) passed on my personal Mac with macOS Mojave 10.14.2 (18C54).
|
Failed on macOS High Sierra 10.13.6 (17G4015)
|
Tests are passing for me now! Yay 🎉 |
Change https://golang.org/cl/162860 mentions this issue: |
Change https://golang.org/cl/162861 mentions this issue: |
I am running go 1.11.5 version on Mac 10.13.6 version, I keep getting the $go get k8s.io/api
$dep ensure
|
@Lax77 Please run the test from #24652 (comment). If it passes, just wait for 1.11.6 or 1.12. If not, please open a new issue with the output and tag me. (Locking this issue because we shipped a fix, it's getting hard to follow and we shouldn't keep pinging everyone. If you have a similar issue or if you run the tests and they fail, please open a new issue referencing this one and tagging me.) |
Change https://golang.org/cl/227037 mentions this issue: |
Please answer these questions before submitting your issue. Thanks!
What did you do?
What did you expect to see?
I expected to see the same number of certificates regardless of whether I used cgo.
What did you see instead?
The implementation using CGO resulted in fewer system certificates, which causes problems for our tooling that relies on one of those missing certificates to be in the
SystemCertPool
.System details
The text was updated successfully, but these errors were encountered: