summaryrefslogtreecommitdiff
path: root/src/leap/bitmask/vpn/_checks.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/leap/bitmask/vpn/_checks.py')
-rw-r--r--src/leap/bitmask/vpn/_checks.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/leap/bitmask/vpn/_checks.py b/src/leap/bitmask/vpn/_checks.py
index 9586d096..c9e40f57 100644
--- a/src/leap/bitmask/vpn/_checks.py
+++ b/src/leap/bitmask/vpn/_checks.py
@@ -18,10 +18,10 @@ class ImproperlyConfigured(Exception):
def get_failure_for(provider):
- if not _has_valid_cert(provider):
- raise ImproperlyConfigured('Missing VPN certificate')
if IS_LINUX and not is_pkexec_in_system():
raise NoPkexecAvailable()
+ if not _has_valid_cert(provider):
+ raise ImproperlyConfigured('Missing VPN certificate')
def is_service_ready(provider):
@@ -35,8 +35,11 @@ def is_service_ready(provider):
def cert_expires(provider):
path = get_vpn_cert_path(provider)
- with open(path, 'r') as f:
- cert = f.read()
+ try:
+ with open(path, 'r') as f:
+ cert = f.read()
+ except IOError:
+ return None
_, to = get_cert_time_boundaries(cert)
expiry_date = datetime.fromtimestamp(mktime(to))
return expiry_date