diff options
author | Michael Simacek <msimacek@redhat.com> | 2015-07-20 16:04:07 +0200 |
---|---|---|
committer | Jan Cholasta <jcholast@redhat.com> | 2015-08-26 09:41:36 +0200 |
commit | aad73fad601f576dd83b758f4448839b4e8e87df (patch) | |
tree | c99433fc5aade363e7f9f66a7c08fcfd8e3dfc69 /lite-server.py | |
parent | aebb72e1fb144939285380a6a9261c4d4177195e (diff) | |
download | freeipa-aad73fad601f576dd83b758f4448839b4e8e87df.tar.gz freeipa-aad73fad601f576dd83b758f4448839b4e8e87df.tar.xz freeipa-aad73fad601f576dd83b758f4448839b4e8e87df.zip |
Port from python-krbV to python-gssapi
python-krbV library is deprecated and doesn't work with python 3. Replacing all
it's usages with python-gssapi.
- Removed Backend.krb and KRB5_CCache classes
They were wrappers around krbV classes that cannot really work without them
- Added few utility functions for querying GSSAPI credentials
in krb_utils module. They provide replacements for KRB5_CCache.
- Merged two kinit_keytab functions
- Changed ldap plugin connection defaults to match ipaldap
- Unified getting default realm
Using api.env.realm instead of krbV call
Reviewed-By: Jan Cholasta <jcholast@redhat.com>
Reviewed-By: Robbie Harwood <rharwood@redhat.com>
Reviewed-By: Simo Sorce <ssorce@redhat.com>
Diffstat (limited to 'lite-server.py')
-rwxr-xr-x | lite-server.py | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/lite-server.py b/lite-server.py index 99089b00f..0e867915f 100755 --- a/lite-server.py +++ b/lite-server.py @@ -37,13 +37,27 @@ from paste import httpserver import paste.gzipper from paste.urlmap import URLMap from ipalib import api +from subprocess import check_output, CalledProcessError +import re + +# Ugly hack for test purposes only. GSSAPI has no way to get default ccache +# name, but we don't need it outside test server +def get_default_ccache_name(): + try: + out = check_output(['klist']) + except CalledProcessError: + raise RuntimeError("Default ccache not found. Did you kinit?") + match = re.match(r'^Ticket cache:\s*(\S+)', out) + if not match: + raise RuntimeError("Cannot obtain ccache name") + return match.group(1) class KRBCheater(object): def __init__(self, app): self.app = app self.url = app.url - self.ccname = api.Backend.krb.default_ccname() + self.ccname = get_default_ccache_name() def __call__(self, environ, start_response): environ['KRB5CCNAME'] = self.ccname |