From 93a606b5910ee6fdaa5a1761971fbd3855f064f1 Mon Sep 17 00:00:00 2001 From: Adnan Maolood Date: Tue, 9 Mar 2021 08:59:23 -0500 Subject: [PATCH] certificate.Store: Call os.MkdirAll on Load --- certificate/store.go | 5 +++++ 1 file changed, 5 insertions(+) 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 {