Maint: set PUID and PGID in openvpn configurator

This commit is contained in:
Quentin McGaw (desktop)
2021-08-18 15:44:58 +00:00
parent bd74879303
commit 5140a7b010
5 changed files with 14 additions and 17 deletions

View File

@@ -7,11 +7,11 @@ import (
)
type AuthWriter interface {
WriteAuthFile(user, password string, puid, pgid int) error
WriteAuthFile(user, password string) error
}
// WriteAuthFile writes the OpenVPN auth file to disk with the right permissions.
func (c *configurator) WriteAuthFile(user, password string, puid, pgid int) error {
func (c *configurator) WriteAuthFile(user, password string) error {
file, err := os.Open(c.authFilePath)
if err != nil && !os.IsNotExist(err) {
@@ -28,7 +28,7 @@ func (c *configurator) WriteAuthFile(user, password string, puid, pgid int) erro
_ = file.Close()
return err
}
err = file.Chown(puid, pgid)
err = file.Chown(c.puid, c.pgid)
if err != nil {
_ = file.Close()
return err
@@ -60,7 +60,7 @@ func (c *configurator) WriteAuthFile(user, password string, puid, pgid int) erro
_ = file.Close()
return err
}
err = file.Chown(puid, pgid)
err = file.Chown(c.puid, c.pgid)
if err != nil {
_ = file.Close()
return err