diff options
author | Kali Kaneko (leap communications) <kali@leap.se> | 2016-03-04 00:56:05 -0400 |
---|---|---|
committer | Kali Kaneko (leap communications) <kali@leap.se> | 2016-03-04 00:56:05 -0400 |
commit | ee5033a6a0ce59eaa9e20aea913b6cd710c80ccd (patch) | |
tree | 7974d78ad4ccc2cb408f37c7f5379055b32710ff /bonafide/src | |
parent | cb863861ecb9c5472f134f1026dba250541f4ff4 (diff) |
fix hardcoded ca path
Diffstat (limited to 'bonafide/src')
-rw-r--r-- | bonafide/src/leap/bonafide/_protocol.py | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/bonafide/src/leap/bonafide/_protocol.py b/bonafide/src/leap/bonafide/_protocol.py index e66be191..6a5c8b60 100644 --- a/bonafide/src/leap/bonafide/_protocol.py +++ b/bonafide/src/leap/bonafide/_protocol.py @@ -24,6 +24,7 @@ from collections import defaultdict from leap.bonafide import config from leap.bonafide import provider from leap.bonafide.session import Session, OK +from leap.common.config import get_path_prefix from twisted.cred.credentials import UsernamePassword from twisted.internet.defer import fail @@ -34,6 +35,7 @@ from twisted.python import log # TODO [ ] read provider info COMMANDS = 'signup', 'authenticate', 'logout', 'stats' +_preffix = get_path_prefix() class BonafideProtocol(object): @@ -64,10 +66,8 @@ class BonafideProtocol(object): username, provider_id = config.get_username_and_provider(full_id) credentials = UsernamePassword(username, password) api = self._get_api(provider_id) - cdev_pem = os.path.expanduser( - '~/.config/leap/providers/%s/keys/ca/cacert.pem' % - provider_id) - session = Session(credentials, api, cdev_pem) + provider_pem = _get_provider_ca_path(provider_id) + session = Session(credentials, api, provider_pem) self._sessions[full_id] = session return session @@ -160,3 +160,8 @@ class BonafideProtocol(object): mem = resource.getrusage(resource.RUSAGE_SELF).ru_maxrss return '[+] Bonafide service: [%s sessions] [Mem usage: %s KB]' % ( len(self._sessions), mem / 1024) + + +def _get_provider_ca_path(provider_id): + return os.path.join( + _preffix, 'leap', 'providers', provider_id, 'keys', 'ca', 'cacert.pem') |