mirror of
https://github.com/FiloSottile/mkcert.git
synced 2025-10-13 16:31:41 +08:00
Allow email SANs for S/MIME certificates (#152)
This commit is contained in:

committed by
Filippo Valsorda

parent
c7c85b20ae
commit
0d4cf75db8
8
main.go
8
main.go
@@ -12,6 +12,7 @@ import (
|
||||
"fmt"
|
||||
"log"
|
||||
"net"
|
||||
"net/mail"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
@@ -190,13 +191,16 @@ func (m *mkcert) Run(args []string) {
|
||||
if ip := net.ParseIP(name); ip != nil {
|
||||
continue
|
||||
}
|
||||
if email, err := mail.ParseAddress(name); err == nil && email.Address == name {
|
||||
continue
|
||||
}
|
||||
punycode, err := idna.ToASCII(name)
|
||||
if err != nil {
|
||||
log.Fatalf("ERROR: %q is not a valid hostname or IP: %s", name, err)
|
||||
log.Fatalf("ERROR: %q is not a valid hostname, IP, or email: %s", name, err)
|
||||
}
|
||||
args[i] = punycode
|
||||
if !hostnameRegexp.MatchString(punycode) {
|
||||
log.Fatalf("ERROR: %q is not a valid hostname or IP", name)
|
||||
log.Fatalf("ERROR: %q is not a valid hostname, IP, or email", name)
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user