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

@@ -136,13 +136,15 @@ func _main(ctx context.Context, buildInfo models.BuildInformation,
return err
}
puid, pgid := allSettings.System.PUID, allSettings.System.PGID
const clientTimeout = 15 * time.Second
httpClient := &http.Client{Timeout: clientTimeout}
// Create configurators
alpineConf := alpine.New()
ovpnConf := openvpn.NewConfigurator(
logger.NewChild(logging.Settings{Prefix: "openvpn configurator: "}),
cmder)
cmder, puid, pgid)
dnsCrypto := dnscrypto.New(httpClient, "", "")
const cacertsPath = "/etc/ssl/certs/ca-certificates.crt"
dnsConf := unbound.NewConfigurator(nil, cmder, dnsCrypto,
@@ -200,9 +202,6 @@ func _main(ctx context.Context, buildInfo models.BuildInformation,
return err
}
// Should never change
puid, pgid := allSettings.System.PUID, allSettings.System.PGID
const defaultUsername = "nonrootuser"
nonRootUsername, err := alpineConf.CreateUser(defaultUsername, puid)
if err != nil {
@@ -354,7 +353,7 @@ func _main(ctx context.Context, buildInfo models.BuildInformation,
openvpnLogger := logger.NewChild(logging.Settings{Prefix: "openvpn: "})
openvpnLooper := openvpn.NewLoop(allSettings.VPN.OpenVPN,
allSettings.VPN.Provider, nonRootUsername, puid, pgid, allServers,
allSettings.VPN.Provider, nonRootUsername, allServers,
ovpnConf, firewallConf, routingConf, portForwardLooper, publicIPLooper, unboundLooper,
openvpnLogger, httpClient, buildInfo, allSettings.VersionInformation)
openvpnHandler, openvpnCtx, openvpnDone := goshutdown.NewGoRoutineHandler(