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)
|
cert, err := x509.CreateCertificate(rand.Reader, tpl, m.caCert, csr.PublicKey, m.caKey)
|
||||||
fatalIfErr(err, "failed to generate certificate")
|
fatalIfErr(err, "failed to generate certificate")
|
||||||
|
c, err := x509.ParseCertificate(cert)
|
||||||
|
fatalIfErr(err, "failed to parse generated certificate")
|
||||||
|
|
||||||
var hosts []string
|
var hosts []string
|
||||||
hosts = append(hosts, csr.DNSNames...)
|
hosts = append(hosts, c.DNSNames...)
|
||||||
hosts = append(hosts, csr.EmailAddresses...)
|
hosts = append(hosts, c.EmailAddresses...)
|
||||||
for _, ip := range csr.IPAddresses {
|
for _, ip := range c.IPAddresses {
|
||||||
hosts = append(hosts, ip.String())
|
hosts = append(hosts, ip.String())
|
||||||
}
|
}
|
||||||
for _, uri := range csr.URIs {
|
for _, uri := range c.URIs {
|
||||||
hosts = append(hosts, uri.String())
|
hosts = append(hosts, uri.String())
|
||||||
}
|
}
|
||||||
certFile, _, _ := m.fileNames(hosts)
|
certFile, _, _ := m.fileNames(hosts)
|
||||||
|
Loading…
Reference in New Issue
Block a user