diff options
| author | Adnan Maolood <[email protected]> | 2021-03-09 08:59:23 -0500 |
|---|---|---|
| committer | Adnan Maolood <[email protected]> | 2021-03-09 08:59:28 -0500 |
| commit | 93a606b5910ee6fdaa5a1761971fbd3855f064f1 (patch) | |
| tree | 298fd4a2b0fc401b79b82b0281f4528c40147499 /certificate | |
| parent | tofu: Use stricter file permissions (diff) | |
| download | go-gemini-93a606b5910ee6fdaa5a1761971fbd3855f064f1.tar.xz go-gemini-93a606b5910ee6fdaa5a1761971fbd3855f064f1.zip | |
certificate.Store: Call os.MkdirAll on Loadv0.1.20
Diffstat (limited to 'certificate')
| -rw-r--r-- | certificate/store.go | 5 |
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 { |