From 3ebaa03a307eab2a0a4d31efd143326d6ea592b2 Mon Sep 17 00:00:00 2001 From: "Kali Kaneko (leap communications)" Date: Wed, 19 Apr 2017 17:57:33 +0200 Subject: [bug] stop firewall if was failed close --- src/leap/bitmask/vpn/manager.py | 2 -- src/leap/bitmask/vpn/service.py | 5 ++++- src/leap/bitmask/vpn/vpn.py | 8 ++++++++ 3 files changed, 12 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/leap/bitmask/vpn/manager.py b/src/leap/bitmask/vpn/manager.py index 66fc3d50..1c07976f 100644 --- a/src/leap/bitmask/vpn/manager.py +++ b/src/leap/bitmask/vpn/manager.py @@ -41,7 +41,6 @@ class TunnelManager(object): ((ip1, portA), (ip2, portB), ...) :type remotes: tuple of tuple(str, int) """ - print "INIT", remotes # TODO we can set all the needed ports, gateways and paths in here # TODO need gateways here # sorting them doesn't belong in here @@ -65,7 +64,6 @@ class TunnelManager(object): Start the VPN process. """ result = self._vpn.start() - print "RESULT START --->", result return result def stop(self): diff --git a/src/leap/bitmask/vpn/service.py b/src/leap/bitmask/vpn/service.py index 026f459a..ec9e065b 100644 --- a/src/leap/bitmask/vpn/service.py +++ b/src/leap/bitmask/vpn/service.py @@ -93,7 +93,10 @@ class VPNService(HookableService): if self._started: self._vpn.stop() self._started = False - return {'result': 'stopped'} + return {'result': 'vpn stopped'} + elif self._vpn.is_firewall_up(): + self._vpn.stop_firewall() + return {'result': 'firewall stopped'} else: raise Exception('VPN was not running') diff --git a/src/leap/bitmask/vpn/vpn.py b/src/leap/bitmask/vpn/vpn.py index 5c9e46e3..d32d534b 100644 --- a/src/leap/bitmask/vpn/vpn.py +++ b/src/leap/bitmask/vpn/vpn.py @@ -16,6 +16,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +import commands + from colorama import Fore from leap.bitmask.util import merge_status @@ -68,6 +70,12 @@ class VPNManager(object): print(Fore.GREEN + "VPN: stopped." + Fore.RESET) return True + def stop_firewall(self): + self._firewall.stop() + + def is_firewall_up(self): + return self._firewall.is_up() + def get_status(self): childrenStatus = { "vpn": self._vpn.status, -- cgit v1.2.3