diff options
author | Kali Kaneko <kali@leap.se> | 2017-06-15 09:24:03 -0700 |
---|---|---|
committer | Kali Kaneko (leap communications) <kali@leap.se> | 2017-06-16 19:22:26 +0200 |
commit | 91b001b65f6974897fb0d7fd13991facd8227c47 (patch) | |
tree | 64e389ba68037173f7937af4ffd380e1c684bd67 /src/leap/bitmask/vpn/_management.py | |
parent | b3428331a04bc4d8843b4ef2d4a62eaf3f7beafe (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/_management.py')
-rw-r--r-- | src/leap/bitmask/vpn/_management.py | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/leap/bitmask/vpn/_management.py b/src/leap/bitmask/vpn/_management.py index 26050be6..80a82c93 100644 --- a/src/leap/bitmask/vpn/_management.py +++ b/src/leap/bitmask/vpn/_management.py @@ -79,8 +79,6 @@ class VPNManagement(object): if not self._host or not self._port: raise ImproperlyConfigured('Connection is not configured') - if self.is_connected(): - self._close_management_socket() try: self._tn = UDSTelnet(self._host, self._port) self._tn.read_eager() @@ -117,7 +115,7 @@ class VPNManagement(object): self.connect_retry, retry + 1) def process_log(self): - if not self._watcher: + if not self._watcher or not self._tn: return lines = self._send_command('log 20') @@ -203,6 +201,7 @@ class VPNManagement(object): :type output: list """ for line in output: + status_step = '' stripped = line.strip() if stripped == "END": continue @@ -212,7 +211,10 @@ class VPNManagement(object): try: ts, status_step, ok, ip, remote, port, _, _, _ = parts except ValueError: - ts, status_step, ok, ip, remote, port, _, _ = parts + try: + ts, status_step, ok, ip, remote, port, _, _ = parts + except ValueError: + self.log.debug('Could not parse %s' % parts) state = status_step if state != self._last_state: @@ -280,7 +282,7 @@ class VPNManagement(object): if self.is_connected(): return self._parse_status_and_notify(self._send_command("status")) - def terminate_openvpn(self, shutdown=False): + def terminate(self, shutdown=False): """ Attempts to terminate openvpn by sending a SIGTERM. """ |