From b361856c0ba1e73fbe9901701299e15cccd3d1e2 Mon Sep 17 00:00:00 2001 From: evilsocket Date: Tue, 14 Aug 2018 14:03:11 +0200 Subject: [PATCH] fix: deleting firewall port redirection when tcp.proxy is stopped --- modules/tcp_proxy.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/modules/tcp_proxy.go b/modules/tcp_proxy.go index d3be611a..f651fa32 100644 --- a/modules/tcp_proxy.go +++ b/modules/tcp_proxy.go @@ -236,6 +236,15 @@ func (p *TcpProxy) Start() error { } func (p *TcpProxy) Stop() error { + + if p.Redirection != nil { + log.Debug("Disabling redirection %s", p.Redirection.String()) + if err := p.Session.Firewall.EnableRedirection(p.Redirection, false); err != nil { + return err + } + p.Redirection = nil + } + return p.SetRunning(false, func() { p.listener.Close() })