Skip to content
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

Remote clusters should only send their own CAs. #1108

Merged
merged 1 commit into from
Jun 27, 2017

Conversation

russjones
Copy link
Contributor

@russjones russjones commented Jun 27, 2017

Purpose

At the moment, when doing a Trusted Cluster exchange, the remote cluster sends all the CAs that it has to the main cluster which then adds these CAs to it's own backend. Then the main CA sends it's CAs to the Trusted Cluster which adds them to it's own backend.

This exchange works correctly the first time it occurs. However if you try and add an existing Trusted Cluster twice, since the Trusted Cluster sends all of the CAs it has, it sends back the CA for the main cluster as well, but it sends it back without signing keys. The main cluster adds it to it's backend which then causes an error similar to the following to occur when trying to add a node (because the CA legitimately no longer has it's signing keys).

failed to join the cluster: main has no signing keys

To fix this problem, the Trusted Cluster should only send it's own CAs to the main cluster.

Implementation

  • When the remote cluster gets a list of CAs, filter out all non-local CAs.
  • Improved logging so we log the certificate authorities we send and receive.
  • Added test coverage in the integration package to upsert a Trusted Cluster multiple time and check that the right certificates were exchanged.

Related Issues

Fixes #1050


// create a request to validate a trusted cluster (token and local certificate authorities)
validateRequest := ValidateTrustedClusterRequest{
Token: trustedCluster.GetToken(),
CAs: localCertAuthorities,
}

// log the local certificate authorities that we are sending
Copy link
Contributor

Choose a reason for hiding this comment

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

seems like a lot of repetition of the same logic, can you factor this into separate function, e.g.

type CertAuthorities []CertAuthority

func (s CertAuthorities) String() string {
  ... formatting logic
}

so later you can do this:

log.Debugf("[TRUSTED CLUSTER %v", CertAuthority(validateRequest.CAs))

Copy link
Contributor

@klizhentas klizhentas left a comment

Choose a reason for hiding this comment

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

looks good except verbose formatting logic

Copy link
Contributor

@kontsevoy kontsevoy left a comment

Choose a reason for hiding this comment

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

LGTM but I would like @klizhentas to take a look as well.

@russjones russjones force-pushed the rjones/send-correct-ca branch from b25bef3 to 2286c65 Compare June 27, 2017 18:56
@russjones
Copy link
Contributor Author

russjones commented Jun 27, 2017

@klizhentas Made the changes you suggested, can you take another look?

@russjones russjones merged commit 580cc5a into master Jun 27, 2017
@russjones russjones deleted the rjones/send-correct-ca branch June 27, 2017 19:01
hatched pushed a commit that referenced this pull request Feb 1, 2023
Calling `electron-builder install-app-deps` during `yarn
build-and-package-term` is unnecessary as `electron-builder build`
already does that.

The only time where you'd need to run `electron-builder
install-app-deps` is when you just cloned the repo and would like to run
the dev version of the app without building the prod version.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2.0.6 to 2.2 alpha upgrade issue with DynamoDB backend
3 participants