Validate external CA URLs when creating a cluster for the first time, and accept the CA cert
Open
@cyli is already working on this.
Since May 16, 2017.
area/security
- Dominant language
- Go
- Stars
- 3.7k
- Forks
- 676
- Avg merge
- 4d 9h
- Merged PRs (30d)
- 6
Description
We validate that the external URLs are reachable and have an HTTPS scheme on updating the cluster, but not when initializing a cluster with external URLs. See https://github.com/moby/moby/issues/33216
Probable tasks:
- refactor some of the external CA validation logic from
manager/controlapi/ca_rotation.gointo thecapackage - update
node/node.go'sConfigto have a field for CA key and CA certificate - in
node/node.go'sloadSecurityConfigfunction, instead of justCreateRootCAif we need to create a new root CA, check if there is a cert and key configured in then.configobject, or a cert and external CAs (and fail if there is neither a key nor external CAs matching the cert)- if there is a key and cert, generate a
RootCAobject usingca.NewRootCAwith the cert and key - use it to create leaf certs - if there is a cert and external CAs, generate a
RootCAobject usingca.NewRootCAwith just the cert, and use aca.NewExternalCAobject to create the leaf certs (note that the external CA cannot require mTLS at this point, because we have no certs - in a future PR, we can add other authentication mechanisms)
- if there is a key and cert, generate a
- Add tests in
node/node_test.goto cover theloadSecurityConfigcase where there is a CA key and cert provided, where there is a CA cert provided only and no external CAs, and a CA cert provided with an external CA. - plumb the cert and key through to the manager config in
manager/manager.go, and make surenode/node.gopasses this information along to the manager - in
manager/manager.go'sbecomeLeaderfunction, set the CA cert and key on theinitialCAConfig, which gets passed toCreateCluster. - Add tests in
manager/manager_test.goto ensure that these values are respected - Add integration test in
integration/integration_test.goto cover creating a cluster with a provided CA cert and key.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.