Clears port forward status file at exit, fix #125
This commit is contained in:
@@ -21,6 +21,7 @@ type Configurator interface {
|
||||
BuildConf(connections []models.OpenVPNConnection, encryption models.PIAEncryption, verbosity, uid, gid int, root bool, cipher, auth string) (err error)
|
||||
GetPortForward() (port uint16, err error)
|
||||
WritePortForward(filepath models.Filepath, port uint16, uid, gid int) (err error)
|
||||
ClearPortForward(filepath models.Filepath, uid, gid int) (err error)
|
||||
AllowPortForwardFirewall(device models.VPNDevice, port uint16) (err error)
|
||||
}
|
||||
|
||||
|
||||
@@ -49,3 +49,8 @@ func (c *configurator) AllowPortForwardFirewall(device models.VPNDevice, port ui
|
||||
c.logger.Info("%s: Allowing forwarded port %d through firewall", logPrefix, port)
|
||||
return c.firewall.AllowInputTrafficOnPort(device, port)
|
||||
}
|
||||
|
||||
func (c *configurator) ClearPortForward(filepath models.Filepath, uid, gid int) (err error) {
|
||||
c.logger.Info("%s: Clearing forwarded port status file %s", logPrefix, filepath)
|
||||
return c.fileManager.WriteToFile(string(filepath), nil, files.Ownership(uid, gid), files.Permissions(400))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user