Print the right hosts when a CSR doesn't have SANs
Close #344 Fixes #318
This commit is contained in:
parent
789f1b1c70
commit
e4df8ab302
10
cert.go
10
cert.go
@ -253,14 +253,16 @@ func (m *mkcert) makeCertFromCSR() {
|
||||
|
||||
cert, err := x509.CreateCertificate(rand.Reader, tpl, m.caCert, csr.PublicKey, m.caKey)
|
||||
fatalIfErr(err, "failed to generate certificate")
|
||||
c, err := x509.ParseCertificate(cert)
|
||||
fatalIfErr(err, "failed to parse generated certificate")
|
||||
|
||||
var hosts []string
|
||||
hosts = append(hosts, csr.DNSNames...)
|
||||
hosts = append(hosts, csr.EmailAddresses...)
|
||||
for _, ip := range csr.IPAddresses {
|
||||
hosts = append(hosts, c.DNSNames...)
|
||||
hosts = append(hosts, c.EmailAddresses...)
|
||||
for _, ip := range c.IPAddresses {
|
||||
hosts = append(hosts, ip.String())
|
||||
}
|
||||
for _, uri := range csr.URIs {
|
||||
for _, uri := range c.URIs {
|
||||
hosts = append(hosts, uri.String())
|
||||
}
|
||||
certFile, _, _ := m.fileNames(hosts)
|
||||
|
Loading…
Reference in New Issue
Block a user