Skip to content
This repository has been archived by the owner on Mar 24, 2022. It is now read-only.

forcing fly under darwin to load system root ca by x509 method #242

Closed
wants to merge 1 commit into from

Conversation

xtremerui
Copy link

@xtremerui xtremerui commented Jul 13, 2018

Trying to fix concourse/concourse#2133

Whey @bsnchan had the issue I got a chance to check their environment. It seems like the issue is scoped to darwin where keychain manages system root CA and intermediate CA differently. If there is no ca_cert specified, fly tends to let tls to populate the RootCA itself, which ends up picking up the CA sets under system root only (not 100% sure if it is using the same way that x509 does. If it is then it would be a bug that golang could not fully load system CAs under darwin).

x509.SystemCertPool() instead will pick up from both places refer to here

A related read here mentions for adding intermediate CA to system root CA in darwin is prohibited thus fly in this case needs to load that from ~/Library/Keychains/login.keychain or /Library/Keychains/System.keychain

@xtremerui xtremerui requested review from vito and jwntrs July 13, 2018 18:55
@@ -83,8 +83,6 @@ func (atcConfig ATCConfig) Validate(
displayhelpers.Failf("configuration invalid")
}

fmt.Println("looks good")
Copy link
Contributor

Choose a reason for hiding this comment

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

this shouldn't be removed

Copy link
Author

Choose a reason for hiding this comment

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

oh my bad... it is "looks good" for validation.

Expect((*base).TLSClientConfig).To(Equal(&tls.Config{
InsecureSkipVerify: true,
RootCAs: nil,
RootCAs: expectedCaCertPool,
Copy link
Contributor

Choose a reason for hiding this comment

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

As far as I can tell, this should be equivalent. The Go docs for RootCAs say that if it's specified as nil, it uses the system cert pool. Were you able to confirm this fixes it?

Copy link
Author

Choose a reason for hiding this comment

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

@vito after test locally I can confirm this PR wont fix the problem. It turned out that x509/root_darwin.go doesn't pick up ANY intermediate certificate from /Library/Keychains/System.keychain. In my case it doesn't pick up my localhost intermediate ca, not Pivotal Intermediate CA and not DigiCert SHA2 ... etc. Note root CA is in yellow and intermediate ca is in blue.

screen shot 2018-07-21 at 12 55 47 am

Not sure if we gonna jump in this rabbit hole but chaining the certs when config atc tls_cert is probably the best solutions for now. I could update the original issue and close this PR.

@xtremerui xtremerui closed this Jul 24, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

fly cli not finding an intermediate ca certificate
2 participants