From e5e1b7a5309169ae88d32d67f3fb949c1462b4da Mon Sep 17 00:00:00 2001 From: Ruben Pollan Date: Tue, 18 Jul 2017 22:37:02 +0200 Subject: [feat] clean up the firewall on bitmask start Just in chance the firewall was not properly cleaned up in a previeous run (bitmask crashed, some bugs in the code, ...). Let's clean up the firewall when it starts. - Resolves: #8979 --- src/leap/bitmask/vpn/service.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/leap/bitmask/vpn/service.py b/src/leap/bitmask/vpn/service.py index 054845f..e9b5add 100644 --- a/src/leap/bitmask/vpn/service.py +++ b/src/leap/bitmask/vpn/service.py @@ -57,7 +57,7 @@ class VPNService(HookableService): super(VPNService, self).__init__() self._tunnel = None - self._firewall = None + self._firewall = FirewallManager([]) self._domain = '' if basepath is None: @@ -65,6 +65,9 @@ class VPNService(HookableService): else: self._basepath = basepath + if self._firewall.is_up(): + self._firewall.stop() + def startService(self): # TODO this could trigger a check for validity of the certificates, # etc. @@ -114,7 +117,7 @@ class VPNService(HookableService): defer.returnValue({'result': 'started'}) def stop_vpn(self): - if self._firewall and self._firewall.is_up(): + if self._firewall.is_up(): fw_ok = self._firewall.stop() if not fw_ok: self.log.error("Firewall: error stopping") @@ -136,8 +139,7 @@ class VPNService(HookableService): if self._tunnel: childrenStatus['vpn'] = self._tunnel.status - if self._firewall: - childrenStatus['firewall'] = self._firewall.status + childrenStatus['firewall'] = self._firewall.status status = merge_status(childrenStatus) if self._domain: -- cgit v1.2.3