mirror of https://github.com/k3s-io/k3s
Add new CLI flag to disable TLS SAN CN filtering
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>pull/8268/head
parent
2cb7023660
commit
cba9f0d142
|
@ -47,6 +47,7 @@ type Server struct {
|
|||
KubeConfigMode string
|
||||
HelmJobImage string
|
||||
TLSSan cli.StringSlice
|
||||
TLSSanSecurity bool
|
||||
BindAddress string
|
||||
EnablePProf bool
|
||||
ExtraAPIArgs cli.StringSlice
|
||||
|
@ -202,6 +203,11 @@ var ServerFlags = []cli.Flag{
|
|||
Usage: "(listener) Add additional hostnames or IPv4/IPv6 addresses as Subject Alternative Names on the server TLS cert",
|
||||
Value: &ServerConfig.TLSSan,
|
||||
},
|
||||
&cli.BoolTFlag{
|
||||
Name: "tls-san-security",
|
||||
Usage: "(listener) Protect the server TLS cert by refusing to add Subject Alternative Names not associated with the kubernetes apiserver service, server nodes, or values of the tls-san option (default: true)",
|
||||
Destination: &ServerConfig.TLSSanSecurity,
|
||||
},
|
||||
DataDirFlag,
|
||||
ClusterCIDR,
|
||||
ServiceCIDR,
|
||||
|
|
|
@ -132,6 +132,7 @@ func run(app *cli.Context, cfg *cmds.Server, leaderControllers server.CustomCont
|
|||
serverConfig.ControlConfig.Rootless = cfg.Rootless
|
||||
serverConfig.ControlConfig.ServiceLBNamespace = cfg.ServiceLBNamespace
|
||||
serverConfig.ControlConfig.SANs = util.SplitStringSlice(cfg.TLSSan)
|
||||
serverConfig.ControlConfig.SANSecurity = cfg.TLSSanSecurity
|
||||
serverConfig.ControlConfig.BindAddress = cfg.BindAddress
|
||||
serverConfig.ControlConfig.SupervisorPort = cfg.SupervisorPort
|
||||
serverConfig.ControlConfig.HTTPSPort = cfg.HTTPSPort
|
||||
|
|
|
@ -52,8 +52,10 @@ func (c *Cluster) newListener(ctx context.Context) (net.Listener, http.Handler,
|
|||
return nil, nil, err
|
||||
}
|
||||
c.config.SANs = append(c.config.SANs, "kubernetes", "kubernetes.default", "kubernetes.default.svc", "kubernetes.default.svc."+c.config.ClusterDomain)
|
||||
c.config.Runtime.ClusterControllerStarts["server-cn-filter"] = func(ctx context.Context) {
|
||||
registerAddressHandlers(ctx, c)
|
||||
if c.config.SANSecurity {
|
||||
c.config.Runtime.ClusterControllerStarts["server-cn-filter"] = func(ctx context.Context) {
|
||||
registerAddressHandlers(ctx, c)
|
||||
}
|
||||
}
|
||||
storage := tlsStorage(ctx, c.config.DataDir, c.config.Runtime)
|
||||
return wrapHandler(dynamiclistener.NewListenerWithChain(tcp, storage, certs, key, dynamiclistener.Config{
|
||||
|
|
|
@ -220,6 +220,7 @@ type Control struct {
|
|||
|
||||
BindAddress string
|
||||
SANs []string
|
||||
SANSecurity bool
|
||||
PrivateIP string
|
||||
Runtime *ControlRuntime `json:"-"`
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue