[ca] Make the control API server take a security config instead of RootCA#2051
Merged
Merged
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2051 +/- ##
==========================================
- Coverage 54.22% 54.16% -0.06%
==========================================
Files 111 111
Lines 19319 19327 +8
==========================================
- Hits 10476 10469 -7
- Misses 7594 7601 +7
- Partials 1249 1257 +8Continue to review full report at Codecov.
|
3 tasks
b725072 to
84b6005
Compare
diogomonica
approved these changes
Mar 24, 2017
| updatedRootCA, err := NewRootCA(rCA.CACert, signingCert, signingKey, expiry, intermediates) | ||
| if err != nil { | ||
| logger.WithError(err).Error("invalid Root CA object in cluster") | ||
| return err |
Collaborator
There was a problem hiding this comment.
Logging the error and returning it is usually wrong. It's probably better for the caller to log it.
Contributor
Author
There was a problem hiding this comment.
Good point, fixed this and updated the comment where this is called in cluster update.
d6b9e94 to
9f5a18f
Compare
| // updated again with different CA info and the security config gets changed under us, that's still fine because | ||
| // this cluster update would fail anyway due to its version being too low on write. | ||
| if err := s.scu.UpdateRootCA(ctx, cluster); err != nil { | ||
| return grpc.Errorf(codes.Internal, "could not update security config") |
Collaborator
There was a problem hiding this comment.
Would it be helpful to include err here? Or log it?
Contributor
Author
There was a problem hiding this comment.
Yes, definitely. Will add that.
… and a security config updater function so we can be sure the security config is always up-to-date with the latest cluster RootCA object. Signed-off-by: cyli <ying.li@docker.com>
9f5a18f to
3bf7af5
Compare
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.
This is also a minor refactor needed because the root CA can change over time now, so is needed for generating new join tokens and also for generating cross-signed certs when doing root rotations (when updating the swarm cluster).
We also make sure, when updating the cluster, to update the security config to reflect the latest version of the cluster to prevent join tokens from being generated using an older version of the
RootCA.