Clears port forward status file at exit, fix #125

This commit is contained in:
Quentin McGaw
2020-04-09 12:11:36 +00:00
parent e7a475a303
commit 60cec716b2
3 changed files with 11 additions and 0 deletions

View File

@@ -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))
}