summaryrefslogtreecommitdiff
path: root/src/leap/bitmask/vpn
diff options
context:
space:
mode:
authorRuben Pollan <meskio@sindominio.net>2017-03-01 01:58:05 +0100
committerRuben Pollan <meskio@sindominio.net>2017-03-03 10:50:53 +0100
commitaf3866350e94c9238889a1c2485661466b1ec2dc (patch)
tree950511ec09ea238abb58de7ac28f2a5f19abec73 /src/leap/bitmask/vpn
parent4003aaaa124b1ffa77d07f7e2ae5d16e2dddacf1 (diff)
[bug] use username instead of provider in the vpn calls
Without active user we need to use the username instead of the provider in the VPN API. - Resolves: #8783
Diffstat (limited to 'src/leap/bitmask/vpn')
-rw-r--r--src/leap/bitmask/vpn/README.rst4
-rw-r--r--src/leap/bitmask/vpn/service.py22
2 files changed, 12 insertions, 14 deletions
diff --git a/src/leap/bitmask/vpn/README.rst b/src/leap/bitmask/vpn/README.rst
index eff62ab..f773e2f 100644
--- a/src/leap/bitmask/vpn/README.rst
+++ b/src/leap/bitmask/vpn/README.rst
@@ -11,7 +11,7 @@ It only works through the cli right now::
srp_token iye7s1J7M3_iCdB4gXEAhxs-if3XOCwpKNPnvTC8ycE
uuid b63ac83826c7e1e903ed18f6f7780491
- bitmaskctl vpn get_cert demo.bitmask.net
+ bitmaskctl vpn get_cert
get_cert ok
bitmaskctl vpn check
@@ -26,7 +26,7 @@ authentication)::
And finally you should be able to launch the VPN::
- bitmaskctl vpn start demo.bitmask.net
+ bitmaskctl vpn start
start ok
result started
diff --git a/src/leap/bitmask/vpn/service.py b/src/leap/bitmask/vpn/service.py
index e56546e..60de0f6 100644
--- a/src/leap/bitmask/vpn/service.py
+++ b/src/leap/bitmask/vpn/service.py
@@ -27,8 +27,6 @@ from twisted.internet import defer
from leap.bitmask.hooks import HookableService
from leap.bitmask.vpn.vpn import VPNManager
from leap.bitmask.vpn._checks import is_service_ready, get_vpn_cert_path
-from leap.bitmask.vpn._config import get_bitmask_helper_path
-from leap.bitmask.vpn._config import get_bitmask_polkit_policy_path
from leap.bitmask.vpn import privilege
from leap.common.config import get_path_prefix
from leap.common.files import check_and_fix_urw_only
@@ -88,22 +86,22 @@ class VPNService(HookableService):
status['domain'] = self._domain
return status
- def do_check(self):
+ def do_check(self, domain):
"""Check whether the VPN Service is properly configured,
and can be started"""
- # TODO either pass a provider, or set a given provider
- _ready = is_service_ready('demo.bitmask.net')
- if _ready:
- result = 'ok'
- else:
- result = 'no'
- return {'vpn_ready': result}
+ return {'vpn_ready': is_service_ready(domain)}
@defer.inlineCallbacks
- def do_get_cert(self, provider):
+ def do_get_cert(self, username):
+ try:
+ _, provider = username.split('@')
+ except ValueError:
+ raise ValueError(username + ' is not a valid username, it should'
+ ' contain an @')
+
# fetch vpn cert and store
bonafide = self.parent.getServiceNamed("bonafide")
- _, cert_str = yield bonafide.do_get_vpn_cert()
+ _, cert_str = yield bonafide.do_get_vpn_cert(username)
cert_path = get_vpn_cert_path(provider)
cert_dir = os.path.dirname(cert_path)