diff options
| author | Grégoire Duchêne <gduchene@awhk.org> | 2020-08-16 13:29:19 +0100 |
|---|---|---|
| committer | Grégoire Duchêne <gduchene@awhk.org> | 2020-08-16 13:35:48 +0100 |
| commit | 7fee28764127f855966fcb315922b415de8ecf75 (patch) | |
| tree | e21c0e5170cc0ab72a9cb7e40d88078942a5b44f | |
| parent | aea02cab94c6c16b247620be3eaf29d6d974b8d7 (diff) | |
Add CN to the SAN list if any SAN is defined
| -rw-r--r-- | main.go | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -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() } |
