diff options
Diffstat (limited to 'src/leap/bitmask')
-rw-r--r-- | src/leap/bitmask/vpn/_control.py | 5 | ||||
-rw-r--r-- | src/leap/bitmask/vpn/service.py | 16 |
2 files changed, 16 insertions, 5 deletions
diff --git a/src/leap/bitmask/vpn/_control.py b/src/leap/bitmask/vpn/_control.py index a4909346..6d4db965 100644 --- a/src/leap/bitmask/vpn/_control.py +++ b/src/leap/bitmask/vpn/_control.py @@ -61,11 +61,6 @@ class VPNControl(object): logger.info("Another vpn process is running. Will try to stop it.") vpnproc.stop_if_already_running() - # FIXME it would be good to document where the - # errors here are catched, since we currently handle them - # at the frontend layer. This *should* move to be handled entirely - # in the backend. - try: cmd = vpnproc.getCommand() except Exception as e: diff --git a/src/leap/bitmask/vpn/service.py b/src/leap/bitmask/vpn/service.py index 2766b8c0..026f459a 100644 --- a/src/leap/bitmask/vpn/service.py +++ b/src/leap/bitmask/vpn/service.py @@ -35,6 +35,12 @@ from leap.common.files import check_and_fix_urw_only from leap.common.certs import get_cert_time_boundaries +class ImproperlyConfigured(Exception): + """This error is a transient exception until autoconf automates all the + needed steps for VPN bootstrap.""" + expected = True + + class VPNService(HookableService): name = 'vpn' @@ -121,6 +127,8 @@ class VPNService(HookableService): try: _, provider = username.split('@') except ValueError: + if not username: + raise ValueError('Need an username. are you logged in?') raise ValueError(username + ' is not a valid username, it should' ' contain an @') @@ -163,6 +171,14 @@ class VPNService(HookableService): cert_path = key_path = os.path.join(prefix, "client", "openvpn.pem") ca_path = os.path.join(prefix, "ca", "cacert.pem") + if not os.path.isfile(cert_path): + raise ImproperlyConfigured( + 'Cannot find client certificate. Please get one') + if not os.path.isfile(ca_path): + raise ImproperlyConfigured( + 'Cannot find provider certificate. ' + 'Please configure provider.') + self._vpn = VPNManager(provider, remotes, cert_path, key_path, ca_path, extra_flags) |