summaryrefslogtreecommitdiff
path: root/src/leap/bitmask/vpn/_checks.py
blob: 3a1914f1dd3325ca45a1dda9145225b6cac5065f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import os

from leap.common.config import get_path_prefix


class ImproperlyConfigured(Exception):
    pass


def is_service_ready(provider):
    valid_cert = _has_valid_cert(provider)
    return True


def get_eip_cert_path(provider):
    return os.path.join(get_path_prefix(),
                        'leap', 'providers', provider, 
                        'keys', 'client', 'openvpn.pem')


def _has_valid_cert(provider):
    cert_path = get_eip_cert_path(provider)
    has_file = os.path.isfile(cert_path)
    if not has_file:
        raise ImproperlyConfigured('Missing EIP certificate')