summaryrefslogtreecommitdiff
path: root/src/leap/bitmask/vpn/fw
diff options
context:
space:
mode:
authorKali Kaneko <kali@leap.se>2017-06-15 09:24:03 -0700
committerKali Kaneko (leap communications) <kali@leap.se>2017-06-16 19:22:26 +0200
commit91b001b65f6974897fb0d7fd13991facd8227c47 (patch)
tree64e389ba68037173f7937af4ffd380e1c684bd67 /src/leap/bitmask/vpn/fw
parentb3428331a04bc4d8843b4ef2d4a62eaf3f7beafe (diff)
[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
Diffstat (limited to 'src/leap/bitmask/vpn/fw')
-rw-r--r--src/leap/bitmask/vpn/fw/firewall.py8
1 files changed, 6 insertions, 2 deletions
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):