From 7fee28764127f855966fcb315922b415de8ecf75 Mon Sep 17 00:00:00 2001 From: Grégoire Duchêne Date: Sun, 16 Aug 2020 13:29:19 +0100 Subject: Add CN to the SAN list if any SAN is defined --- main.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/main.go b/main.go index 7fee39e..455842d 100644 --- a/main.go +++ b/main.go @@ -20,6 +20,7 @@ import ( "math/big" "net" "os" + "sort" "time" ) @@ -167,6 +168,11 @@ func main() { if country == "" { log.Fatalln("error: -c is required") } + // See RFC 6125§6.4.4. + if len(dnsNames) > 0 || len(ips) > 0 { + dnsNames = append(dnsNames, commonName) + } + sort.Strings(dnsNames) if from.t.IsZero() { from.t = time.Now() } -- cgit v1.2.3-70-g09d2