From 91b001b65f6974897fb0d7fd13991facd8227c47 Mon Sep 17 00:00:00 2001 From: Kali Kaneko Date: Thu, 15 Jun 2017 09:24:03 -0700 Subject: [feat] fix OpenVPN start/stop in OSX using a process canary - correctly start the openvpn process canary - use helper to fix tearing down of the vpn --- src/leap/bitmask/vpn/fw/firewall.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/leap/bitmask/vpn/fw') diff --git a/src/leap/bitmask/vpn/fw/firewall.py b/src/leap/bitmask/vpn/fw/firewall.py index dcd956d..7147971 100644 --- a/src/leap/bitmask/vpn/fw/firewall.py +++ b/src/leap/bitmask/vpn/fw/firewall.py @@ -48,27 +48,31 @@ class _OSXFirewallManager(object): def __init__(self, remotes): self._remotes = list(remotes) self._helper = darwin.HelperCommand() + self._started = False def start(self, restart=False): gateways = [gateway for gateway, port in self._remotes] cmd = 'firewall_start %s' % (' '.join(gateways),) self._helper.send(cmd) + self._started = True # TODO parse OK from result return True def stop(self): cmd = 'firewall_stop' self._helper.send(cmd) + self._started = False return True def is_up(self): # TODO implement!!! - return True + return self._started @property def status(self): # TODO implement!!! -- factor out, too - return {'status': 'on', 'error': None} + status = 'on' if self._started else 'off' + return {'status': status, 'error': None} class _LinuxFirewallManager(object): -- cgit v1.2.3