summaryrefslogtreecommitdiff
path: root/src/leap/bitmask/vpn
diff options
context:
space:
mode:
authorKali Kaneko <kali@leap.se>2018-01-22 21:14:48 +0100
committerKali Kaneko <kali@leap.se>2018-01-25 01:19:18 +0100
commit7e05218519b1306a838a3fccfe342b8260af5b75 (patch)
tree4b0f859885be87f9c7ea9b79ee0740b22a8be414 /src/leap/bitmask/vpn
parent2d72f6eb4b220c8dfa3c64b2f6b82365791f0424 (diff)
[bug] several fixes after review
Diffstat (limited to 'src/leap/bitmask/vpn')
-rw-r--r--src/leap/bitmask/vpn/_checks.py1
-rw-r--r--src/leap/bitmask/vpn/autostart.py5
-rw-r--r--src/leap/bitmask/vpn/service.py7
3 files changed, 5 insertions, 8 deletions
diff --git a/src/leap/bitmask/vpn/_checks.py b/src/leap/bitmask/vpn/_checks.py
index c9e40f57..681f7428 100644
--- a/src/leap/bitmask/vpn/_checks.py
+++ b/src/leap/bitmask/vpn/_checks.py
@@ -62,5 +62,4 @@ def _has_valid_cert(provider):
if datetime.now() > expiry:
log.warn("VPN cert expired for %s" % (provider,))
return False
-
return True
diff --git a/src/leap/bitmask/vpn/autostart.py b/src/leap/bitmask/vpn/autostart.py
index af7b3669..858ea4ab 100644
--- a/src/leap/bitmask/vpn/autostart.py
+++ b/src/leap/bitmask/vpn/autostart.py
@@ -41,8 +41,5 @@ Terminal=false
if IS_MAC:
- def autostart_app_on():
- pass
-
- def autostart_app_off():
+ def autostart_app(status):
pass
diff --git a/src/leap/bitmask/vpn/service.py b/src/leap/bitmask/vpn/service.py
index 0ca0f566..6d273e23 100644
--- a/src/leap/bitmask/vpn/service.py
+++ b/src/leap/bitmask/vpn/service.py
@@ -216,13 +216,13 @@ class VPNService(HookableService):
status['domain'] = self._read_last()
return status
- def do_check(self, domain=None):
+ def do_check(self, domain=None, timeout=1):
"""Check whether the VPN Service is properly configured,
and can be started. This returns info about the helpers being
installed, a polkit agent being present, and optionally a valid
certificate present for a domain."""
hashelpers = helpers.check()
- privcheck = helpers.privcheck(timeout=5)
+ privcheck = helpers.privcheck(timeout=1)
ret = {'installed': hashelpers, 'privcheck': privcheck}
if not privcheck:
if IS_LINUX:
@@ -323,7 +323,8 @@ class VPNService(HookableService):
key_path = cert_path
anonvpn = self._has_anonvpn(provider)
- if not os.path.isfile(cert_path):
+ ready = self.do_check(provider_id).get('vpn_ready', False)
+ if not ready:
yield self._maybe_get_anon_cert(anonvpn, provider_id)
if not os.path.isfile(ca_path):