Skip to content

Commit 2505205

Browse files
liggittk8s-publishing-bot
authored andcommitted
Remove invalid SAN certificate construction
Kubernetes-commit: f40e4ce55298e0d0ea0149987e774b44a276075c
1 parent 7ffba0f commit 2505205

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

util/cert/cert.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,15 @@ func NewSelfSignedCACert(cfg Config, key crypto.Signer) (*x509.Certificate, erro
7575
CommonName: cfg.CommonName,
7676
Organization: cfg.Organization,
7777
},
78-
DNSNames: []string{cfg.CommonName},
7978
NotBefore: notBefore,
8079
NotAfter: now.Add(duration365d * 10).UTC(),
8180
KeyUsage: x509.KeyUsageKeyEncipherment | x509.KeyUsageDigitalSignature | x509.KeyUsageCertSign,
8281
BasicConstraintsValid: true,
8382
IsCA: true,
8483
}
84+
if len(cfg.CommonName) > 0 {
85+
tmpl.DNSNames = []string{cfg.CommonName}
86+
}
8587

8688
certDERBytes, err := x509.CreateCertificate(cryptorand.Reader, &tmpl, &tmpl, key.Public(), key)
8789
if err != nil {

0 commit comments

Comments
 (0)