Skip to content

Commit a8711c9

Browse files
mcpherrinmjsha
authored andcommitted
Remove CommonName from issued certificates
The Baseline requirements now says Common Name is "Not Recommended" for subscriber server certificates, so this follows that recommendation.
1 parent 3fe019b commit a8711c9

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

ca/ca.go

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -252,12 +252,7 @@ func (ca *CAImpl) newChain(intermediateKey crypto.Signer, intermediateSubject pk
252252
}
253253

254254
func (ca *CAImpl) newCertificate(domains []string, ips []net.IP, key crypto.PublicKey, accountID, notBefore, notAfter string) (*core.Certificate, error) {
255-
var cn string
256-
if len(domains) > 0 {
257-
cn = domains[0]
258-
} else if len(ips) > 0 {
259-
cn = ips[0].String()
260-
} else {
255+
if len(domains) == 0 || len(ips) == 0 {
261256
return nil, fmt.Errorf("must specify at least one domain name or IP address")
262257
}
263258

@@ -294,11 +289,8 @@ func (ca *CAImpl) newCertificate(domains []string, ips []net.IP, key crypto.Publ
294289

295290
serial := makeSerial()
296291
template := &x509.Certificate{
297-
DNSNames: domains,
298-
IPAddresses: ips,
299-
Subject: pkix.Name{
300-
CommonName: cn,
301-
},
292+
DNSNames: domains,
293+
IPAddresses: ips,
302294
SerialNumber: serial,
303295
NotBefore: certNotBefore,
304296
NotAfter: certNotAfter,

0 commit comments

Comments
 (0)