aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdnan Maolood <[email protected]>2021-03-09 08:59:23 -0500
committerAdnan Maolood <[email protected]>2021-03-09 08:59:28 -0500
commit93a606b5910ee6fdaa5a1761971fbd3855f064f1 (patch)
tree298fd4a2b0fc401b79b82b0281f4528c40147499
parenttofu: Use stricter file permissions (diff)
downloadgo-gemini-0.1.20.tar.xz
go-gemini-0.1.20.zip
certificate.Store: Call os.MkdirAll on Loadv0.1.20
-rw-r--r--certificate/store.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/certificate/store.go b/certificate/store.go
index 0cf0392..a106946 100644
--- a/certificate/store.go
+++ b/certificate/store.go
@@ -6,6 +6,7 @@ import (
"crypto/x509/pkix"
"errors"
"fmt"
+ "os"
"path/filepath"
"strings"
"sync"
@@ -160,6 +161,10 @@ func (s *Store) createCertificate(scope string) (tls.Certificate, error) {
// and private keys named "scope.crt" and "scope.key" respectively,
// where "scope" is the scope of the certificate.
func (s *Store) Load(path string) error {
+ if err := os.MkdirAll(filepath.Dir(path), 0700); err != nil {
+ return err
+ }
+
path = filepath.Clean(path)
matches, err := filepath.Glob(filepath.Join(path, "*.crt"))
if err != nil {