mirror of
https://github.com/FiloSottile/mkcert.git
synced 2025-10-13 16:31:41 +08:00
Fix permissions on newly generated private keys (#3)
Signed-off-by: Patrick Uiterwijk <patrick@puiterwijk.org>
This commit is contained in:

committed by
Filippo Valsorda

parent
6eb6ca5d60
commit
3532f34209
4
main.go
4
main.go
@@ -160,11 +160,11 @@ func (m *mkcert) makeCert(hosts []string) {
|
||||
privDER, err := x509.MarshalPKCS8PrivateKey(priv)
|
||||
fatalIfErr(err, "failed to encode certificate key")
|
||||
err = ioutil.WriteFile(filename+"-key.pem", pem.EncodeToMemory(
|
||||
&pem.Block{Type: "PRIVATE KEY", Bytes: privDER}), 0644)
|
||||
&pem.Block{Type: "PRIVATE KEY", Bytes: privDER}), 0400)
|
||||
fatalIfErr(err, "failed to save certificate key")
|
||||
|
||||
err = ioutil.WriteFile(filename+".pem", pem.EncodeToMemory(
|
||||
&pem.Block{Type: "CERTIFICATE", Bytes: cert}), 0600)
|
||||
&pem.Block{Type: "CERTIFICATE", Bytes: cert}), 0644)
|
||||
fatalIfErr(err, "failed to save certificate key")
|
||||
|
||||
log.Printf("\nCreated a new certificate valid for the following names 📜")
|
||||
|
Reference in New Issue
Block a user