|
|
ad145f |
From 8e3e85e329f5cbd989936b0df8a0ac06906a4824 Mon Sep 17 00:00:00 2001
|
|
|
ad145f |
From: Isaac Boukris <iboukris@gmail.com>
|
|
|
ad145f |
Date: Tue, 14 Apr 2020 16:19:05 +0300
|
|
|
ad145f |
Subject: [PATCH] auth: add SASL/GSSAPI tests
|
|
|
ad145f |
|
|
|
ad145f |
---
|
|
|
ad145f |
tests/data/krb5.conf | 32 ++++++
|
|
|
ad145f |
tests/data/slapd-sasl-gssapi.conf | 65 ++++++++++++
|
|
|
ad145f |
tests/scripts/conf.sh | 3 +
|
|
|
ad145f |
tests/scripts/defines.sh | 5 +
|
|
|
ad145f |
tests/scripts/setup_kdc.sh | 144 +++++++++++++++++++++++++++
|
|
|
ad145f |
tests/scripts/test077-sasl-gssapi | 159 ++++++++++++++++++++++++++++++
|
|
|
ad145f |
6 files changed, 408 insertions(+)
|
|
|
ad145f |
create mode 100644 tests/data/krb5.conf
|
|
|
ad145f |
create mode 100644 tests/data/slapd-sasl-gssapi.conf
|
|
|
ad145f |
create mode 100755 tests/scripts/setup_kdc.sh
|
|
|
ad145f |
create mode 100755 tests/scripts/test077-sasl-gssapi
|
|
|
ad145f |
|
|
|
ad145f |
diff --git a/tests/data/krb5.conf b/tests/data/krb5.conf
|
|
|
ad145f |
new file mode 100644
|
|
|
ad145f |
index 000000000..739113742
|
|
|
ad145f |
--- /dev/null
|
|
|
ad145f |
+++ b/tests/data/krb5.conf
|
|
|
ad145f |
@@ -0,0 +1,32 @@
|
|
|
ad145f |
+[libdefaults]
|
|
|
ad145f |
+ default_realm = @KRB5REALM@
|
|
|
ad145f |
+ dns_lookup_realm = false
|
|
|
ad145f |
+ dns_lookup_kdc = false
|
|
|
ad145f |
+ default_ccache_name = FILE://@TESTDIR@/ccache
|
|
|
ad145f |
+ #udp_preference_limit = 1
|
|
|
ad145f |
+[realms]
|
|
|
ad145f |
+ @KRB5REALM@ = {
|
|
|
ad145f |
+ kdc = @KDCHOST@:@KDCPORT@
|
|
|
ad145f |
+ acl_file = @TESTDIR@/kadm.acl
|
|
|
ad145f |
+ database_name = @TESTDIR@/kdc.db
|
|
|
ad145f |
+ key_stash_file = @TESTDIR@/kdc.stash
|
|
|
ad145f |
+ }
|
|
|
ad145f |
+[kdcdefaults]
|
|
|
ad145f |
+ kdc_ports = @KDCPORT@
|
|
|
ad145f |
+ kdc_tcp_ports = @KDCPORT@
|
|
|
ad145f |
+[logging]
|
|
|
ad145f |
+ kdc = FILE:@TESTDIR@/kdc.log
|
|
|
ad145f |
+ admin_server = FILE:@TESTDIR@/kadm.log
|
|
|
ad145f |
+ default = FILE:@TESTDIR@/krb5.log
|
|
|
ad145f |
+
|
|
|
ad145f |
+#Heimdal
|
|
|
ad145f |
+[kdc]
|
|
|
ad145f |
+ database = {
|
|
|
ad145f |
+ dbname = @TESTDIR@/kdc.db
|
|
|
ad145f |
+ realm = @KRB5REALM@
|
|
|
ad145f |
+ mkey_file = @TESTDIR@/kdc.stash
|
|
|
ad145f |
+ log_file = @TESTDIR@/kdc.log
|
|
|
ad145f |
+ acl_file = @TESTDIR@/kadm.acl
|
|
|
ad145f |
+ }
|
|
|
ad145f |
+[hdb]
|
|
|
ad145f |
+ db-dir = @TESTDIR@
|
|
|
ad145f |
diff --git a/tests/data/slapd-sasl-gssapi.conf b/tests/data/slapd-sasl-gssapi.conf
|
|
|
ad145f |
new file mode 100644
|
|
|
ad145f |
index 000000000..611fc7097
|
|
|
ad145f |
--- /dev/null
|
|
|
ad145f |
+++ b/tests/data/slapd-sasl-gssapi.conf
|
|
|
ad145f |
@@ -0,0 +1,65 @@
|
|
|
ad145f |
+# stand-alone slapd config -- for testing (with indexing)
|
|
|
ad145f |
+# $OpenLDAP$
|
|
|
ad145f |
+## This work is part of OpenLDAP Software <http://www.openldap.org/>.
|
|
|
ad145f |
+##
|
|
|
ad145f |
+## Copyright 1998-2020 The OpenLDAP Foundation.
|
|
|
ad145f |
+## All rights reserved.
|
|
|
ad145f |
+##
|
|
|
ad145f |
+## Redistribution and use in source and binary forms, with or without
|
|
|
ad145f |
+## modification, are permitted only as authorized by the OpenLDAP
|
|
|
ad145f |
+## Public License.
|
|
|
ad145f |
+##
|
|
|
ad145f |
+## A copy of this license is available in the file LICENSE in the
|
|
|
ad145f |
+## top-level directory of the distribution or, alternatively, at
|
|
|
ad145f |
+## <http://www.OpenLDAP.org/license.html>.
|
|
|
ad145f |
+
|
|
|
ad145f |
+#
|
|
|
ad145f |
+include @SCHEMADIR@/core.schema
|
|
|
ad145f |
+include @SCHEMADIR@/cosine.schema
|
|
|
ad145f |
+#
|
|
|
ad145f |
+include @SCHEMADIR@/corba.schema
|
|
|
ad145f |
+include @SCHEMADIR@/java.schema
|
|
|
ad145f |
+include @SCHEMADIR@/inetorgperson.schema
|
|
|
ad145f |
+include @SCHEMADIR@/misc.schema
|
|
|
ad145f |
+include @SCHEMADIR@/nis.schema
|
|
|
ad145f |
+include @SCHEMADIR@/openldap.schema
|
|
|
ad145f |
+#
|
|
|
ad145f |
+include @SCHEMADIR@/duaconf.schema
|
|
|
ad145f |
+include @SCHEMADIR@/dyngroup.schema
|
|
|
ad145f |
+
|
|
|
ad145f |
+#
|
|
|
ad145f |
+pidfile @TESTDIR@/slapd.1.pid
|
|
|
ad145f |
+argsfile @TESTDIR@/slapd.1.args
|
|
|
ad145f |
+
|
|
|
ad145f |
+# SSL configuration
|
|
|
ad145f |
+TLSCACertificateFile @TESTDIR@/tls/ca/certs/testsuiteCA.crt
|
|
|
ad145f |
+TLSCertificateKeyFile @TESTDIR@/tls/private/localhost.key
|
|
|
ad145f |
+TLSCertificateFile @TESTDIR@/tls/certs/localhost.crt
|
|
|
ad145f |
+
|
|
|
ad145f |
+#
|
|
|
ad145f |
+rootdse @DATADIR@/rootdse.ldif
|
|
|
ad145f |
+
|
|
|
ad145f |
+#mod#modulepath ../servers/slapd/back-@BACKEND@/
|
|
|
ad145f |
+#mod#moduleload back_@BACKEND@.la
|
|
|
ad145f |
+#monitormod#modulepath ../servers/slapd/back-monitor/
|
|
|
ad145f |
+#monitormod#moduleload back_monitor.la
|
|
|
ad145f |
+
|
|
|
ad145f |
+
|
|
|
ad145f |
+#######################################################################
|
|
|
ad145f |
+# database definitions
|
|
|
ad145f |
+#######################################################################
|
|
|
ad145f |
+
|
|
|
ad145f |
+database @BACKEND@
|
|
|
ad145f |
+suffix "dc=example,dc=com"
|
|
|
ad145f |
+rootdn "cn=Manager,dc=example,dc=com"
|
|
|
ad145f |
+rootpw secret
|
|
|
ad145f |
+#~null~#directory @TESTDIR@/db.1.a
|
|
|
ad145f |
+#indexdb#index objectClass eq
|
|
|
ad145f |
+#indexdb#index mail eq
|
|
|
ad145f |
+#ndb#dbname db_1_a
|
|
|
ad145f |
+#ndb#include @DATADIR@/ndb.conf
|
|
|
ad145f |
+
|
|
|
ad145f |
+#monitor#database monitor
|
|
|
ad145f |
+
|
|
|
ad145f |
+sasl-realm @KRB5REALM@
|
|
|
ad145f |
+sasl-host localhost
|
|
|
ad145f |
diff --git a/tests/scripts/conf.sh b/tests/scripts/conf.sh
|
|
|
ad145f |
index b0393865d..c9e1a4b0a 100755
|
|
|
ad145f |
--- a/tests/scripts/conf.sh
|
|
|
ad145f |
+++ b/tests/scripts/conf.sh
|
|
|
ad145f |
@@ -99,4 +99,7 @@ sed -e "s/@BACKEND@/${BACKEND}/" \
|
|
|
ad145f |
-e "s;@TESTWD@;${TESTWD};" \
|
|
|
ad145f |
-e "s;@DATADIR@;${DATADIR};" \
|
|
|
ad145f |
-e "s;@SCHEMADIR@;${SCHEMADIR};" \
|
|
|
ad145f |
+ -e "s;@KRB5REALM@;${KRB5REALM};" \
|
|
|
ad145f |
+ -e "s;@KDCHOST@;${KDCHOST};" \
|
|
|
ad145f |
+ -e "s;@KDCPORT@;${KDCPORT};" \
|
|
|
ad145f |
-e "/^#/d"
|
|
|
ad145f |
diff --git a/tests/scripts/defines.sh b/tests/scripts/defines.sh
|
|
|
ad145f |
index 1d6c2b3f1..ccb2e5b41 100755
|
|
|
ad145f |
--- a/tests/scripts/defines.sh
|
|
|
ad145f |
+++ b/tests/scripts/defines.sh
|
|
|
ad145f |
@@ -114,6 +114,7 @@ REFSLAVECONF=$DATADIR/slapd-ref-slave.conf
|
|
|
ad145f |
SCHEMACONF=$DATADIR/slapd-schema.conf
|
|
|
ad145f |
TLSCONF=$DATADIR/slapd-tls.conf
|
|
|
ad145f |
TLSSASLCONF=$DATADIR/slapd-tls-sasl.conf
|
|
|
ad145f |
+SASLGSSAPICONF=$DATADIR/slapd-sasl-gssapi.conf
|
|
|
ad145f |
GLUECONF=$DATADIR/slapd-glue.conf
|
|
|
ad145f |
REFINTCONF=$DATADIR/slapd-refint.conf
|
|
|
ad145f |
RETCODECONF=$DATADIR/slapd-retcode.conf
|
|
|
ad145f |
@@ -223,6 +224,7 @@ PORT3=`expr $BASEPORT + 3`
|
|
|
ad145f |
PORT4=`expr $BASEPORT + 4`
|
|
|
ad145f |
PORT5=`expr $BASEPORT + 5`
|
|
|
ad145f |
PORT6=`expr $BASEPORT + 6`
|
|
|
ad145f |
+KDCPORT=`expr $BASEPORT + 7`
|
|
|
ad145f |
URI1="ldap://${LOCALHOST}:$PORT1/"
|
|
|
ad145f |
URIP1="ldap://${LOCALIP}:$PORT1/"
|
|
|
ad145f |
URI2="ldap://${LOCALHOST}:$PORT2/"
|
|
|
ad145f |
@@ -248,6 +250,9 @@ SURIP5="ldaps://${LOCALIP}:$PORT5/"
|
|
|
ad145f |
SURI6="ldaps://${LOCALHOST}:$PORT6/"
|
|
|
ad145f |
SURIP6="ldaps://${LOCALIP}:$PORT6/"
|
|
|
ad145f |
|
|
|
ad145f |
+KRB5REALM="K5.REALM"
|
|
|
ad145f |
+KDCHOST=$LOCALHOST
|
|
|
ad145f |
+
|
|
|
ad145f |
# LDIF
|
|
|
ad145f |
LDIF=$DATADIR/test.ldif
|
|
|
ad145f |
LDIFADD1=$DATADIR/do_add.1
|
|
|
ad145f |
diff --git a/tests/scripts/setup_kdc.sh b/tests/scripts/setup_kdc.sh
|
|
|
ad145f |
new file mode 100755
|
|
|
ad145f |
index 000000000..1cb784075
|
|
|
ad145f |
--- /dev/null
|
|
|
ad145f |
+++ b/tests/scripts/setup_kdc.sh
|
|
|
ad145f |
@@ -0,0 +1,144 @@
|
|
|
ad145f |
+#! /bin/sh
|
|
|
ad145f |
+# $OpenLDAP$
|
|
|
ad145f |
+## This work is part of OpenLDAP Software <http://www.openldap.org/>.
|
|
|
ad145f |
+##
|
|
|
ad145f |
+## Copyright 1998-2020 The OpenLDAP Foundation.
|
|
|
ad145f |
+## All rights reserved.
|
|
|
ad145f |
+##
|
|
|
ad145f |
+## Redistribution and use in source and binary forms, with or without
|
|
|
ad145f |
+## modification, are permitted only as authorized by the OpenLDAP
|
|
|
ad145f |
+## Public License.
|
|
|
ad145f |
+##
|
|
|
ad145f |
+## A copy of this license is available in the file LICENSE in the
|
|
|
ad145f |
+## top-level directory of the distribution or, alternatively, at
|
|
|
ad145f |
+## <http://www.OpenLDAP.org/license.html>.
|
|
|
ad145f |
+
|
|
|
ad145f |
+export KRB5_TRACE=$TESTDIR/k5_trace
|
|
|
ad145f |
+export KRB5_CONFIG=$TESTDIR/krb5.conf
|
|
|
ad145f |
+export KRB5_KDC_PROFILE=$KRB5_CONFIG
|
|
|
ad145f |
+export KRB5_KTNAME=$TESTDIR/server.kt
|
|
|
ad145f |
+export KRB5_CLIENT_KTNAME=$TESTDIR/client.kt
|
|
|
ad145f |
+export KRB5CCNAME=$TESTDIR/client.ccache
|
|
|
ad145f |
+
|
|
|
ad145f |
+KDCLOG=$TESTDIR/setup_kdc.log
|
|
|
ad145f |
+KSERVICE=ldap/$LOCALHOST
|
|
|
ad145f |
+KUSER=kuser
|
|
|
ad145f |
+
|
|
|
ad145f |
+. $CONFFILTER < $DATADIR/krb5.conf > $KRB5_CONFIG
|
|
|
ad145f |
+
|
|
|
ad145f |
+PATH=${PATH}:/usr/lib/heimdal-servers:/usr/sbin:/usr/local/sbin
|
|
|
ad145f |
+
|
|
|
ad145f |
+echo "Trying Heimdal KDC..."
|
|
|
ad145f |
+
|
|
|
ad145f |
+kdc --version 2>&1 | grep Heimdal > $KDCLOG 2>&1
|
|
|
ad145f |
+RC=$?
|
|
|
ad145f |
+if test $RC = 0 ; then
|
|
|
ad145f |
+
|
|
|
ad145f |
+ kstash --random-key > $KDCLOG 2>&1
|
|
|
ad145f |
+ RC=$?
|
|
|
ad145f |
+ if test $RC != 0 ; then
|
|
|
ad145f |
+ echo "Heimdal: kstash failed, skipping GSSAPI tests"
|
|
|
ad145f |
+ exit 0
|
|
|
ad145f |
+ fi
|
|
|
ad145f |
+
|
|
|
ad145f |
+ flags="--realm-max-ticket-life=1h --realm-max-renewable-life=1h"
|
|
|
ad145f |
+ kadmin -l init $flags $KRB5REALM > $KDCLOG 2>&1
|
|
|
ad145f |
+ RC=$?
|
|
|
ad145f |
+ if test $RC != 0 ; then
|
|
|
ad145f |
+ echo "Heimdal: kadmin init failed, skipping GSSAPI tests"
|
|
|
ad145f |
+ exit 0
|
|
|
ad145f |
+ fi
|
|
|
ad145f |
+
|
|
|
ad145f |
+ kadmin -l add --random-key --use-defaults $KSERVICE > $KDCLOG 2>&1
|
|
|
ad145f |
+ RC=$?
|
|
|
ad145f |
+ if test $RC != 0 ; then
|
|
|
ad145f |
+ echo "Heimdal: kadmin add failed, skipping GSSAPI tests"
|
|
|
ad145f |
+ exit 0
|
|
|
ad145f |
+ fi
|
|
|
ad145f |
+
|
|
|
ad145f |
+ kadmin -l ext -k $KRB5_KTNAME $KSERVICE > $KDCLOG 2>&1
|
|
|
ad145f |
+ RC=$?
|
|
|
ad145f |
+ if test $RC != 0 ; then
|
|
|
ad145f |
+ echo "Heimdal: kadmin ext failed, skipping GSSAPI tests"
|
|
|
ad145f |
+ exit 0
|
|
|
ad145f |
+ fi
|
|
|
ad145f |
+
|
|
|
ad145f |
+ kadmin -l add --random-key --use-defaults $KUSER > $KDCLOG 2>&1
|
|
|
ad145f |
+ RC=$?
|
|
|
ad145f |
+ if test $RC != 0 ; then
|
|
|
ad145f |
+ echo "Heimdal: kadmin add failed, skipping GSSAPI tests"
|
|
|
ad145f |
+ exit 0
|
|
|
ad145f |
+ fi
|
|
|
ad145f |
+
|
|
|
ad145f |
+ kadmin -l ext -k $KRB5_CLIENT_KTNAME $KUSER > $KDCLOG 2>&1
|
|
|
ad145f |
+ RC=$?
|
|
|
ad145f |
+ if test $RC != 0 ; then
|
|
|
ad145f |
+ echo "Heimdal: kadmin ext failed, skipping GSSAPI tests"
|
|
|
ad145f |
+ exit 0
|
|
|
ad145f |
+ fi
|
|
|
ad145f |
+
|
|
|
ad145f |
+ kdc --addresses=$LOCALIP --ports="$KDCPORT/udp" > $KDCLOG 2>&1 &
|
|
|
ad145f |
+else
|
|
|
ad145f |
+ echo "Trying MIT KDC..."
|
|
|
ad145f |
+
|
|
|
ad145f |
+ kdb5_util create -r $KRB5REALM -s -P password > $KDCLOG 2>&1
|
|
|
ad145f |
+ RC=$?
|
|
|
ad145f |
+ if test $RC != 0 ; then
|
|
|
ad145f |
+ echo "MIT: kdb5_util create failed, skipping GSSAPI tests"
|
|
|
ad145f |
+ exit 0
|
|
|
ad145f |
+ fi
|
|
|
ad145f |
+
|
|
|
ad145f |
+ kadmin.local -q "addprinc -randkey $KSERVICE" > $KDCLOG 2>&1
|
|
|
ad145f |
+ RC=$?
|
|
|
ad145f |
+ if test $RC != 0 ; then
|
|
|
ad145f |
+ echo "MIT: admin addprinc failed, skipping GSSAPI tests"
|
|
|
ad145f |
+ exit 0
|
|
|
ad145f |
+ fi
|
|
|
ad145f |
+
|
|
|
ad145f |
+ kadmin.local -q "ktadd -k $KRB5_KTNAME $KSERVICE" > $KDCLOG 2>&1
|
|
|
ad145f |
+ RC=$?
|
|
|
ad145f |
+ if test $RC != 0 ; then
|
|
|
ad145f |
+ echo "MIT: kadmin ktadd failed, skipping GSSAPI tests"
|
|
|
ad145f |
+ exit 0
|
|
|
ad145f |
+ fi
|
|
|
ad145f |
+
|
|
|
ad145f |
+ kadmin.local -q "addprinc -randkey $KUSER" > $KDCLOG 2>&1
|
|
|
ad145f |
+ RC=$?
|
|
|
ad145f |
+ if test $RC != 0 ; then
|
|
|
ad145f |
+ echo "MIT: kadmin addprinc failed, skipping GSSAPI tests"
|
|
|
ad145f |
+ exit 0
|
|
|
ad145f |
+ fi
|
|
|
ad145f |
+
|
|
|
ad145f |
+ kadmin.local -q "ktadd -k $KRB5_CLIENT_KTNAME $KUSER" > $KDCLOG 2>&1
|
|
|
ad145f |
+ RC=$?
|
|
|
ad145f |
+ if test $RC != 0 ; then
|
|
|
ad145f |
+ echo "MIT: kadmin ktadd failed, skipping GSSAPI tests"
|
|
|
ad145f |
+ exit 0
|
|
|
ad145f |
+ fi
|
|
|
ad145f |
+
|
|
|
ad145f |
+ krb5kdc -n > $KDCLOG 2>&1 &
|
|
|
ad145f |
+fi
|
|
|
ad145f |
+
|
|
|
ad145f |
+KDCPROC=$!
|
|
|
ad145f |
+sleep 1
|
|
|
ad145f |
+
|
|
|
ad145f |
+kinit -kt $KRB5_CLIENT_KTNAME $KUSER > $KDCLOG 2>&1
|
|
|
ad145f |
+RC=$?
|
|
|
ad145f |
+if test $RC != 0 ; then
|
|
|
ad145f |
+ kill $KDCPROC
|
|
|
ad145f |
+ echo "SASL/GSSAPI: kinit failed, skipping GSSAPI tests"
|
|
|
ad145f |
+ exit 0
|
|
|
ad145f |
+fi
|
|
|
ad145f |
+
|
|
|
ad145f |
+pluginviewer -m GSSAPI > $TESTDIR/plugin_out 2>/dev/null
|
|
|
ad145f |
+RC=$?
|
|
|
ad145f |
+if test $RC != 0 ; then
|
|
|
ad145f |
+
|
|
|
ad145f |
+ saslpluginviewer -m GSSAPI > $TESTDIR/plugin_out 2>/dev/null
|
|
|
ad145f |
+ RC=$?
|
|
|
ad145f |
+ if test $RC != 0 ; then
|
|
|
ad145f |
+ kill $KDCPROC
|
|
|
ad145f |
+ echo "cyrus-sasl has no GSSAPI support, test skipped"
|
|
|
ad145f |
+ exit 0
|
|
|
ad145f |
+ fi
|
|
|
ad145f |
+fi
|
|
|
ad145f |
diff --git a/tests/scripts/test077-sasl-gssapi b/tests/scripts/test077-sasl-gssapi
|
|
|
ad145f |
new file mode 100755
|
|
|
ad145f |
index 000000000..64abe16fe
|
|
|
ad145f |
--- /dev/null
|
|
|
ad145f |
+++ b/tests/scripts/test077-sasl-gssapi
|
|
|
ad145f |
@@ -0,0 +1,159 @@
|
|
|
ad145f |
+#! /bin/sh
|
|
|
ad145f |
+# $OpenLDAP$
|
|
|
ad145f |
+## This work is part of OpenLDAP Software <http://www.openldap.org/>.
|
|
|
ad145f |
+##
|
|
|
ad145f |
+## Copyright 1998-2020 The OpenLDAP Foundation.
|
|
|
ad145f |
+## All rights reserved.
|
|
|
ad145f |
+##
|
|
|
ad145f |
+## Redistribution and use in source and binary forms, with or without
|
|
|
ad145f |
+## modification, are permitted only as authorized by the OpenLDAP
|
|
|
ad145f |
+## Public License.
|
|
|
ad145f |
+##
|
|
|
ad145f |
+## A copy of this license is available in the file LICENSE in the
|
|
|
ad145f |
+## top-level directory of the distribution or, alternatively, at
|
|
|
ad145f |
+## <http://www.OpenLDAP.org/license.html>.
|
|
|
ad145f |
+
|
|
|
ad145f |
+echo "running defines.sh"
|
|
|
ad145f |
+. $SRCDIR/scripts/defines.sh
|
|
|
ad145f |
+
|
|
|
ad145f |
+if test $WITH_SASL = no ; then
|
|
|
ad145f |
+ echo "SASL support not available, test skipped"
|
|
|
ad145f |
+ exit 0
|
|
|
ad145f |
+fi
|
|
|
ad145f |
+
|
|
|
ad145f |
+mkdir -p $TESTDIR $DBDIR1
|
|
|
ad145f |
+cp -r $DATADIR/tls $TESTDIR
|
|
|
ad145f |
+
|
|
|
ad145f |
+cd $TESTWD
|
|
|
ad145f |
+
|
|
|
ad145f |
+
|
|
|
ad145f |
+echo "Starting KDC for SASL/GSSAPI tests..."
|
|
|
ad145f |
+. $SRCDIR/scripts/setup_kdc.sh
|
|
|
ad145f |
+
|
|
|
ad145f |
+echo "Running slapadd to build slapd database..."
|
|
|
ad145f |
+. $CONFFILTER $BACKEND $MONITORDB < $SASLGSSAPICONF > $CONF1
|
|
|
ad145f |
+$SLAPADD -f $CONF1 -l $LDIFORDERED
|
|
|
ad145f |
+RC=$?
|
|
|
ad145f |
+if test $RC != 0 ; then
|
|
|
ad145f |
+ echo "slapadd failed ($RC)!"
|
|
|
ad145f |
+ kill $KDCPROC
|
|
|
ad145f |
+ exit $RC
|
|
|
ad145f |
+fi
|
|
|
ad145f |
+
|
|
|
ad145f |
+echo "Starting ldap:/// slapd on TCP/IP port $PORT1 and ldaps:/// slapd on $PORT2..."
|
|
|
ad145f |
+$SLAPD -f $CONF1 -h "$URI1 $SURI2" -d $LVL $TIMING > $LOG1 2>&1 &
|
|
|
ad145f |
+PID=$!
|
|
|
ad145f |
+if test $WAIT != 0 ; then
|
|
|
ad145f |
+ echo PID $PID
|
|
|
ad145f |
+ read foo
|
|
|
ad145f |
+fi
|
|
|
ad145f |
+KILLPIDS="$PID"
|
|
|
ad145f |
+
|
|
|
ad145f |
+sleep 1
|
|
|
ad145f |
+
|
|
|
ad145f |
+for i in 0 1 2 3 4 5; do
|
|
|
ad145f |
+ $LDAPSEARCH -s base -b "" -H $URI1 \
|
|
|
ad145f |
+ 'objectclass=*' > /dev/null 2>&1
|
|
|
ad145f |
+ RC=$?
|
|
|
ad145f |
+ if test $RC = 0 ; then
|
|
|
ad145f |
+ break
|
|
|
ad145f |
+ fi
|
|
|
ad145f |
+ echo "Waiting 5 seconds for slapd to start..."
|
|
|
ad145f |
+ sleep 5
|
|
|
ad145f |
+done
|
|
|
ad145f |
+
|
|
|
ad145f |
+if test $RC != 0 ; then
|
|
|
ad145f |
+ echo "ldapsearch failed ($RC)!"
|
|
|
ad145f |
+ kill $KDCPROC
|
|
|
ad145f |
+ test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
|
|
ad145f |
+ exit $RC
|
|
|
ad145f |
+fi
|
|
|
ad145f |
+
|
|
|
ad145f |
+$LDAPSEARCH -x -H $URI1 -s "base" -b "" supportedSASLMechanisms > $TESTOUT 2>&1
|
|
|
ad145f |
+RC=$?
|
|
|
ad145f |
+if test $RC != 0 ; then
|
|
|
ad145f |
+ echo "ldapsearch failed ($RC)!"
|
|
|
ad145f |
+ kill $KDCPROC
|
|
|
ad145f |
+ test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
|
|
ad145f |
+ exit $RC
|
|
|
ad145f |
+fi
|
|
|
ad145f |
+
|
|
|
ad145f |
+grep GSSAPI $TESTOUT
|
|
|
ad145f |
+RC=$?
|
|
|
ad145f |
+if test $RC != 0 ; then
|
|
|
ad145f |
+ echo "failed: GSSAPI mechanism not in supportedSASLMechanisms."
|
|
|
ad145f |
+ kill $KDCPROC
|
|
|
ad145f |
+ test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
|
|
ad145f |
+ exit $RC
|
|
|
ad145f |
+fi
|
|
|
ad145f |
+
|
|
|
ad145f |
+echo -n "Using ldapwhoami with SASL/GSSAPI: "
|
|
|
ad145f |
+$LDAPSASLWHOAMI -N -Y GSSAPI -H $URI1 > $TESTOUT 2>&1
|
|
|
ad145f |
+RC=$?
|
|
|
ad145f |
+if test $RC != 0 ; then
|
|
|
ad145f |
+ echo "ldapwhoami failed ($RC)!"
|
|
|
ad145f |
+ kill $KDCPROC
|
|
|
ad145f |
+ test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
|
|
ad145f |
+ exit $RC
|
|
|
ad145f |
+else
|
|
|
ad145f |
+ echo "success"
|
|
|
ad145f |
+fi
|
|
|
ad145f |
+
|
|
|
ad145f |
+echo -n "Validating mapped SASL/GSSAPI ID: "
|
|
|
ad145f |
+echo "dn:uid=$KUSER,cn=$KRB5REALM,cn=gssapi,cn=auth" > $TESTDIR/dn.out
|
|
|
ad145f |
+$CMP $TESTDIR/dn.out $TESTOUT > $CMPOUT
|
|
|
ad145f |
+RC=$?
|
|
|
ad145f |
+if test $RC != 0 ; then
|
|
|
ad145f |
+ echo "Comparison failed"
|
|
|
ad145f |
+ kill $KDCPROC
|
|
|
ad145f |
+ test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
|
|
ad145f |
+ exit $RC
|
|
|
ad145f |
+else
|
|
|
ad145f |
+ echo "success"
|
|
|
ad145f |
+fi
|
|
|
ad145f |
+
|
|
|
ad145f |
+if test $WITH_TLS = no ; then
|
|
|
ad145f |
+ echo "SASL/GSSAPI: TLS support not available, skipping TLS part."
|
|
|
ad145f |
+else
|
|
|
ad145f |
+ echo -n "Using ldapwhoami with SASL/GSSAPI with start-tls: "
|
|
|
ad145f |
+ $LDAPSASLWHOAMI -N -Y GSSAPI -H $URI1 -ZZ -o tls_reqcert=allow \
|
|
|
ad145f |
+ -o tls_cacert=$TESTDIR/tls/ca/certs/testsuiteCA.crt \
|
|
|
ad145f |
+ > $TESTOUT 2>&1
|
|
|
ad145f |
+ RC=$?
|
|
|
ad145f |
+ if test $RC != 0 ; then
|
|
|
ad145f |
+ echo "ldapwhoami failed ($RC)!"
|
|
|
ad145f |
+ kill $KDCPROC
|
|
|
ad145f |
+ test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
|
|
ad145f |
+ exit $RC
|
|
|
ad145f |
+ else
|
|
|
ad145f |
+ echo "success"
|
|
|
ad145f |
+ fi
|
|
|
ad145f |
+
|
|
|
ad145f |
+ echo -n "Using ldapwhoami with SASL/GSSAPI with ldaps: "
|
|
|
ad145f |
+ $LDAPSASLWHOAMI -N -Y GSSAPI -H $SURI2 -o tls_reqcert=allow \
|
|
|
ad145f |
+ -o tls_cacert=$TESTDIR/tls/ca/certs/testsuiteCA.crt \
|
|
|
ad145f |
+ > $TESTOUT 2>&1
|
|
|
ad145f |
+ RC=$?
|
|
|
ad145f |
+ if test $RC != 0 ; then
|
|
|
ad145f |
+ echo "ldapwhoami failed ($RC)!"
|
|
|
ad145f |
+ kill $KDCPROC
|
|
|
ad145f |
+ test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
|
|
ad145f |
+ exit $RC
|
|
|
ad145f |
+ else
|
|
|
ad145f |
+ echo "success"
|
|
|
ad145f |
+ fi
|
|
|
ad145f |
+fi
|
|
|
ad145f |
+
|
|
|
ad145f |
+kill $KDCPROC
|
|
|
ad145f |
+test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
|
|
ad145f |
+
|
|
|
ad145f |
+if test $RC != 0 ; then
|
|
|
ad145f |
+ echo ">>>>> Test failed"
|
|
|
ad145f |
+else
|
|
|
ad145f |
+ echo ">>>>> Test succeeded"
|
|
|
ad145f |
+ RC=0
|
|
|
ad145f |
+fi
|
|
|
ad145f |
+
|
|
|
ad145f |
+test $KILLSERVERS != no && wait
|
|
|
ad145f |
+
|
|
|
ad145f |
+exit $RC
|
|
|
ad145f |
--
|
|
|
ad145f |
2.26.2
|
|
|
ad145f |
|