Skip to content

Commit

Permalink
server/embed/config: Fix configs to support multi CN / multi hostnames
Browse files Browse the repository at this point in the history
Follow up on the Cherry-pick of [etcd-io#13445](etcd-io#13445)
Allowing the config file of the security config to use multi allowedCN and multi Allowed Hostnames

This won't be cross compatible, if we want to upstream this we need to allow for both AllowedCN and AllowedCNs
  • Loading branch information
nyodas committed Jun 10, 2024
1 parent 54e885a commit 1c5a7c1
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions server/embed/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -443,15 +443,15 @@ type configJSON struct {
}

type securityConfig struct {
CertFile string `json:"cert-file"`
KeyFile string `json:"key-file"`
ClientCertFile string `json:"client-cert-file"`
ClientKeyFile string `json:"client-key-file"`
CertAuth bool `json:"client-cert-auth"`
TrustedCAFile string `json:"trusted-ca-file"`
AutoTLS bool `json:"auto-tls"`
AllowedCN string `json:"allowed-cn"`
AllowedHostname string `json:"allowed-hostname"`
CertFile string `json:"cert-file"`
KeyFile string `json:"key-file"`
ClientCertFile string `json:"client-cert-file"`
ClientKeyFile string `json:"client-key-file"`
CertAuth bool `json:"client-cert-auth"`
TrustedCAFile string `json:"trusted-ca-file"`
AutoTLS bool `json:"auto-tls"`
AllowedCNs []string `json:"allowed-cns"`
AllowedHostnames []string `json:"allowed-hostnames"`
}

// NewConfig creates a new Config populated with default values.
Expand Down Expand Up @@ -631,8 +631,8 @@ func (cfg *configYAML) configFromFile(path string) error {
tls.ClientKeyFile = ysc.ClientKeyFile
tls.ClientCertAuth = ysc.CertAuth
tls.TrustedCAFile = ysc.TrustedCAFile
tls.AllowedCN = ysc.AllowedCN
tls.AllowedHostname = ysc.AllowedHostname
tls.AllowedCNs = ysc.AllowedCNs
tls.AllowedHostnames = ysc.AllowedHostnames
}
copySecurityDetails(&cfg.ClientTLSInfo, &cfg.ClientSecurityJSON)
copySecurityDetails(&cfg.PeerTLSInfo, &cfg.PeerSecurityJSON)
Expand Down

0 comments on commit 1c5a7c1

Please sign in to comment.