mirror of
https://github.com/0xJacky/nginx-ui.git
synced 2025-05-11 02:15: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
|
package cert
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/0xJacky/Nginx-UI/internal/helper"
|
|
||||||
"github.com/0xJacky/Nginx-UI/internal/nginx"
|
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
|
||||||
|
"github.com/0xJacky/Nginx-UI/internal/helper"
|
||||||
|
"github.com/0xJacky/Nginx-UI/internal/nginx"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Content struct {
|
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.
|
// 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.
|
// 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 {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
err = os.MkdirAll(filepath.Dir(c.SSLCertificateKeyPath), 0644)
|
err = os.MkdirAll(filepath.Dir(c.SSLCertificateKeyPath), 0755)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if c.SSLCertificate != "" {
|
if c.SSLCertificate != "" {
|
||||||
err = os.WriteFile(c.SSLCertificatePath, []byte(c.SSLCertificate), 0644)
|
err = os.WriteFile(c.SSLCertificatePath, []byte(c.SSLCertificate), 0755)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if c.SSLCertificateKey != "" {
|
if c.SSLCertificateKey != "" {
|
||||||
err = os.WriteFile(c.SSLCertificateKeyPath, []byte(c.SSLCertificateKey), 0644)
|
err = os.WriteFile(c.SSLCertificateKeyPath, []byte(c.SSLCertificateKey), 0755)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue