diff options
author | Kali Kaneko (leap communications) <kali@leap.se> | 2017-04-19 17:57:33 +0200 |
---|---|---|
committer | Kali Kaneko (leap communications) <kali@leap.se> | 2017-04-19 20:14:31 +0200 |
commit | 3ebaa03a307eab2a0a4d31efd143326d6ea592b2 (patch) | |
tree | 2d91a8947e9cc7c2ca003221e27c172c69cd713d | |
parent | 6227a8ed9c1184eb01eca4e23cc419473e5c5b51 (diff) |
[bug] stop firewall if was failed close
-rw-r--r-- | src/leap/bitmask/vpn/manager.py | 2 | ||||
-rw-r--r-- | src/leap/bitmask/vpn/service.py | 5 | ||||
-rw-r--r-- | src/leap/bitmask/vpn/vpn.py | 8 |
3 files changed, 12 insertions, 3 deletions
diff --git a/src/leap/bitmask/vpn/manager.py b/src/leap/bitmask/vpn/manager.py index 66fc3d5..1c07976 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 026f459..ec9e065 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 5c9e46e..d32d534 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 <http://www.gnu.org/licenses/>. +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, |