aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrégoire Duchêne <gduchene@awhk.org>2020-08-16 13:29:19 +0100
committerGrégoire Duchêne <gduchene@awhk.org>2020-08-16 13:35:48 +0100
commit7fee28764127f855966fcb315922b415de8ecf75 (patch)
treee21c0e5170cc0ab72a9cb7e40d88078942a5b44f
parentaea02cab94c6c16b247620be3eaf29d6d974b8d7 (diff)
Add CN to the SAN list if any SAN is defined
-rw-r--r--main.go6
1 files changed, 6 insertions, 0 deletions
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()
}