mirror of
https://github.com/0xJacky/nginx-ui.git
synced 2025-05-10 18:05:48 +02:00
fix(cert): incorrect permission of ssl dir
This commit is contained in:
parent
7e37664c64
commit
ca5462c11d
1 changed files with 7 additions and 6 deletions
|
@ -1,10 +1,11 @@
|
|||
package cert
|
||||
|
||||
import (
|
||||
"github.com/0xJacky/Nginx-UI/internal/helper"
|
||||
"github.com/0xJacky/Nginx-UI/internal/nginx"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/0xJacky/Nginx-UI/internal/helper"
|
||||
"github.com/0xJacky/Nginx-UI/internal/nginx"
|
||||
)
|
||||
|
||||
type Content struct {
|
||||
|
@ -33,25 +34,25 @@ func (c *Content) WriteFile() (err error) {
|
|||
// The permission bits perm (before umask) are used for all directories that MkdirAll creates.
|
||||
// If path is already a directory, MkdirAll does nothing and returns nil.
|
||||
|
||||
err = os.MkdirAll(filepath.Dir(c.SSLCertificatePath), 0644)
|
||||
err = os.MkdirAll(filepath.Dir(c.SSLCertificatePath), 0755)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = os.MkdirAll(filepath.Dir(c.SSLCertificateKeyPath), 0644)
|
||||
err = os.MkdirAll(filepath.Dir(c.SSLCertificateKeyPath), 0755)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if c.SSLCertificate != "" {
|
||||
err = os.WriteFile(c.SSLCertificatePath, []byte(c.SSLCertificate), 0644)
|
||||
err = os.WriteFile(c.SSLCertificatePath, []byte(c.SSLCertificate), 0755)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
if c.SSLCertificateKey != "" {
|
||||
err = os.WriteFile(c.SSLCertificateKeyPath, []byte(c.SSLCertificateKey), 0644)
|
||||
err = os.WriteFile(c.SSLCertificateKeyPath, []byte(c.SSLCertificateKey), 0755)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue