Skip to content

[ca] Make the control API server take a security config instead of RootCA#2051

Merged
aaronlehmann merged 1 commit into
moby:masterfrom
cyli:api-server-takes-service-config
Mar 24, 2017
Merged

[ca] Make the control API server take a security config instead of RootCA#2051
aaronlehmann merged 1 commit into
moby:masterfrom
cyli:api-server-takes-service-config

Conversation

@cyli
Copy link
Copy Markdown
Contributor

@cyli cyli commented Mar 23, 2017

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.

@cyli cyli changed the title Make the control API server take a security config instead of RootCA [ca] Make the control API server take a security config instead of RootCA Mar 23, 2017
@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 23, 2017

Codecov Report

Merging #2051 into master will decrease coverage by 0.05%.
The diff coverage is 58.33%.

@@            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       +8

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f19ff43...3bf7af5. Read the comment docs.

@cyli cyli changed the title [ca] Make the control API server take a security config instead of RootCA WIP: [ca] Make the control API server take a security config instead of RootCA Mar 23, 2017
@cyli cyli force-pushed the api-server-takes-service-config branch 2 times, most recently from b725072 to 84b6005 Compare March 23, 2017 22:49
@cyli cyli mentioned this pull request Mar 23, 2017
10 tasks
@cyli cyli changed the title WIP: [ca] Make the control API server take a security config instead of RootCA [ca] Make the control API server take a security config instead of RootCA Mar 23, 2017
Comment thread ca/server.go Outdated
updatedRootCA, err := NewRootCA(rCA.CACert, signingCert, signingKey, expiry, intermediates)
if err != nil {
logger.WithError(err).Error("invalid Root CA object in cluster")
return err
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Logging the error and returning it is usually wrong. It's probably better for the caller to log it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good point, fixed this and updated the comment where this is called in cluster update.

@cyli cyli force-pushed the api-server-takes-service-config branch 3 times, most recently from d6b9e94 to 9f5a18f Compare March 24, 2017 01:42
// 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")
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Would it be helpful to include err here? Or log it?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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>
@cyli cyli force-pushed the api-server-takes-service-config branch from 9f5a18f to 3bf7af5 Compare March 24, 2017 02:10
@aaronlehmann aaronlehmann merged commit 4b86e57 into moby:master Mar 24, 2017
@cyli cyli deleted the api-server-takes-service-config branch March 24, 2017 16:46
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.

3 participants