mirror of
https://github.com/StackExchange/dnscontrol.git
synced 2025-01-11 18:08:57 +08:00
get-certs now generates a .pem file in addition to .key and .crt (#750)
This commit is contained in:
parent
d3a90f0a2d
commit
6263e856c9
1 changed files with 4 additions and 0 deletions
|
@ -70,6 +70,7 @@ func (d directoryStorage) StoreCertificate(name string, cert *certificate.Resour
|
||||||
cert.Certificate = nil
|
cert.Certificate = nil
|
||||||
priv := cert.PrivateKey
|
priv := cert.PrivateKey
|
||||||
cert.PrivateKey = nil
|
cert.PrivateKey = nil
|
||||||
|
combined := []byte(string(pub) + "\n" + string(priv))
|
||||||
jDAt, err := json.MarshalIndent(cert, "", " ")
|
jDAt, err := json.MarshalIndent(cert, "", " ")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -80,6 +81,9 @@ func (d directoryStorage) StoreCertificate(name string, cert *certificate.Resour
|
||||||
if err = ioutil.WriteFile(d.certFile(name, "crt"), pub, perms); err != nil {
|
if err = ioutil.WriteFile(d.certFile(name, "crt"), pub, perms); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
if err = ioutil.WriteFile(d.certFile(name, "pem"), combined, perms); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
return ioutil.WriteFile(d.certFile(name, "key"), priv, perms)
|
return ioutil.WriteFile(d.certFile(name, "key"), priv, perms)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue