summaryrefslogtreecommitdiffstats
path: root/tests/tests.py
diff options
context:
space:
mode:
authorRob Crittenden <rcritten@redhat.com>2015-04-28 10:52:55 -0400
committerRob Crittenden <rcritten@redhat.com>2015-05-06 16:00:24 -0400
commit9cbeccde3151029d70bedb0579482e10a5cbab7b (patch)
tree4fcf1cdbda21c7d173405240f5e4a1e9b6e467e1 /tests/tests.py
parente6a3656ab71faea8669af50ceeaf4d9a91fe0142 (diff)
downloadipsilon.git-9cbeccde3151029d70bedb0579482e10a5cbab7b.tar.gz
ipsilon.git-9cbeccde3151029d70bedb0579482e10a5cbab7b.tar.xz
ipsilon.git-9cbeccde3151029d70bedb0579482e10a5cbab7b.zip
Configure a KDC, add test for GSSAPI/Kerberos
Using nss_wrappers so we can control host names we can setup a KDC and test GSSAPI, including fallback to forms-based auth. This also means that fetch_page() needs to handle 401 a bit better, so it can re-try a failed authentication or fall back to forms-based auth. Note for posterity: if gss_localname() fails this is likely due to using the wrong krb5.conf in Apache, so pass in all environment variables. The KDC setup code was based heavily on the tests in the gssproxy project. https://fedorahosted.org/ipsilon/ticket/116 Signed-off-by: Rob Crittenden <rcritten@redhat.com>
Diffstat (limited to 'tests/tests.py')
-rwxr-xr-xtests/tests.py21
1 files changed, 19 insertions, 2 deletions
diff --git a/tests/tests.py b/tests/tests.py
index a8b42e4..65bbcba 100755
--- a/tests/tests.py
+++ b/tests/tests.py
@@ -25,6 +25,7 @@ import sys
import subprocess
import time
import traceback
+from helpers.common import WRAP_HOSTNAME # pylint: disable=relative-import
logger = None
@@ -63,12 +64,27 @@ def try_wrappers(base, wrappers):
else:
raise ValueError('Socket Wrappers not available')
+ pkgcfg = subprocess.Popen(['pkg-config', '--exists', 'nss_wrapper'])
+ pkgcfg.wait()
+ if pkgcfg.returncode != 0:
+ if wrappers == 'auto':
+ return {}
+ else:
+ raise ValueError('Nss Wrappers not available')
+
wrapdir = os.path.join(base, 'wrapdir')
os.mkdir(wrapdir)
- wenv = {'LD_PRELOAD': 'libsocket_wrapper.so',
+ hosts_file = os.path.join(base, 'hosts')
+ with open(hosts_file, 'w+') as f:
+ f.write('127.0.0.9 %s\n' % WRAP_HOSTNAME)
+
+ wenv = {'LD_PRELOAD': 'libsocket_wrapper.so libnss_wrapper.so',
'SOCKET_WRAPPER_DIR': wrapdir,
- 'SOCKET_WRAPPER_DEFAULT_IFACE': '9'}
+ 'SOCKET_WRAPPER_DEFAULT_IFACE': '9',
+ 'SOCKET_WRAPPER_DEBUGLEVEL': '1',
+ 'NSS_WRAPPER_HOSTNAME': WRAP_HOSTNAME,
+ 'NSS_WRAPPER_HOSTS': hosts_file}
return wenv
@@ -90,6 +106,7 @@ if __name__ == '__main__':
env = try_wrappers(test.testdir, args['wrappers'])
env['PYTHONPATH'] = test.rootdir
+ env['TESTDIR'] = test.testdir
try:
test.setup_servers(env)