Propagate the desired CA certificate and CAConfig ForceRotate parameter
in the Docker REST APIs when viewing or updating the swarm spec info, and also propagate the desired CA key in the Docker REST APIs when updating swarm spec info only (it is not available for viewing). Signed-off-by: Ying Li <ying.li@docker.com> Upstream-commit: 1847bb899a07d3dd324e75a3ed9b3489fcfc302f Component: engine
This commit is contained in:
@@ -30,6 +30,11 @@ func SwarmFromGRPC(c swarmapi.Cluster) types.Swarm {
|
||||
EncryptionConfig: types.EncryptionConfig{
|
||||
AutoLockManagers: c.Spec.EncryptionConfig.AutoLockManagers,
|
||||
},
|
||||
CAConfig: types.CAConfig{
|
||||
// do not include the signing CA key (it should already be redacted via the swarm APIs)
|
||||
SigningCACert: string(c.Spec.CAConfig.SigningCACert),
|
||||
ForceRotate: c.Spec.CAConfig.ForceRotate,
|
||||
},
|
||||
},
|
||||
TLSInfo: types.TLSInfo{
|
||||
TrustRoot: string(c.RootCA.CACert),
|
||||
@@ -114,6 +119,14 @@ func MergeSwarmSpecToGRPC(s types.Spec, spec swarmapi.ClusterSpec) (swarmapi.Clu
|
||||
if s.CAConfig.NodeCertExpiry != 0 {
|
||||
spec.CAConfig.NodeCertExpiry = gogotypes.DurationProto(s.CAConfig.NodeCertExpiry)
|
||||
}
|
||||
if s.CAConfig.SigningCACert != "" {
|
||||
spec.CAConfig.SigningCACert = []byte(s.CAConfig.SigningCACert)
|
||||
}
|
||||
if s.CAConfig.SigningCAKey != "" {
|
||||
// do prpagate the signing CA key here because we want to provide it TO the swarm APIs
|
||||
spec.CAConfig.SigningCAKey = []byte(s.CAConfig.SigningCAKey)
|
||||
}
|
||||
spec.CAConfig.ForceRotate = s.CAConfig.ForceRotate
|
||||
|
||||
for _, ca := range s.CAConfig.ExternalCAs {
|
||||
protocol, ok := swarmapi.ExternalCA_CAProtocol_value[strings.ToUpper(string(ca.Protocol))]
|
||||
|
||||
Reference in New Issue
Block a user