|
|
e4ff3b |
From 59bdc8158f51fc22cc3c6d6dd2db9e5aa4bcfdc4 Mon Sep 17 00:00:00 2001
|
|
|
e4ff3b |
From: Ryan Tandy <ryan@nardis.ca>
|
|
|
e4ff3b |
Date: Mon, 27 Apr 2020 23:24:16 -0700
|
|
|
e4ff3b |
Subject: [PATCH] Convert test077 to LDIF config
|
|
|
e4ff3b |
|
|
|
e4ff3b |
---
|
|
|
e4ff3b |
tests/data/slapd-sasl-gssapi.conf | 65 ------------------
|
|
|
e4ff3b |
tests/scripts/defines.sh | 1 -
|
|
|
e4ff3b |
tests/scripts/test077-sasl-gssapi | 108 ++++++++++++++++++++++++++++--
|
|
|
e4ff3b |
3 files changed, 103 insertions(+), 71 deletions(-)
|
|
|
e4ff3b |
delete mode 100644 tests/data/slapd-sasl-gssapi.conf
|
|
|
e4ff3b |
|
|
|
e4ff3b |
diff --git a/tests/data/slapd-sasl-gssapi.conf b/tests/data/slapd-sasl-gssapi.conf
|
|
|
e4ff3b |
deleted file mode 100644
|
|
|
e4ff3b |
index 611fc7097..000000000
|
|
|
e4ff3b |
--- a/tests/data/slapd-sasl-gssapi.conf
|
|
|
e4ff3b |
+++ /dev/null
|
|
|
e4ff3b |
@@ -1,65 +0,0 @@
|
|
|
e4ff3b |
-# stand-alone slapd config -- for testing (with indexing)
|
|
|
e4ff3b |
-# $OpenLDAP$
|
|
|
e4ff3b |
-## This work is part of OpenLDAP Software <http://www.openldap.org/>.
|
|
|
e4ff3b |
-##
|
|
|
e4ff3b |
-## Copyright 1998-2020 The OpenLDAP Foundation.
|
|
|
e4ff3b |
-## All rights reserved.
|
|
|
e4ff3b |
-##
|
|
|
e4ff3b |
-## Redistribution and use in source and binary forms, with or without
|
|
|
e4ff3b |
-## modification, are permitted only as authorized by the OpenLDAP
|
|
|
e4ff3b |
-## Public License.
|
|
|
e4ff3b |
-##
|
|
|
e4ff3b |
-## A copy of this license is available in the file LICENSE in the
|
|
|
e4ff3b |
-## top-level directory of the distribution or, alternatively, at
|
|
|
e4ff3b |
-## <http://www.OpenLDAP.org/license.html>.
|
|
|
e4ff3b |
-
|
|
|
e4ff3b |
-#
|
|
|
e4ff3b |
-include @SCHEMADIR@/core.schema
|
|
|
e4ff3b |
-include @SCHEMADIR@/cosine.schema
|
|
|
e4ff3b |
-#
|
|
|
e4ff3b |
-include @SCHEMADIR@/corba.schema
|
|
|
e4ff3b |
-include @SCHEMADIR@/java.schema
|
|
|
e4ff3b |
-include @SCHEMADIR@/inetorgperson.schema
|
|
|
e4ff3b |
-include @SCHEMADIR@/misc.schema
|
|
|
e4ff3b |
-include @SCHEMADIR@/nis.schema
|
|
|
e4ff3b |
-include @SCHEMADIR@/openldap.schema
|
|
|
e4ff3b |
-#
|
|
|
e4ff3b |
-include @SCHEMADIR@/duaconf.schema
|
|
|
e4ff3b |
-include @SCHEMADIR@/dyngroup.schema
|
|
|
e4ff3b |
-
|
|
|
e4ff3b |
-#
|
|
|
e4ff3b |
-pidfile @TESTDIR@/slapd.1.pid
|
|
|
e4ff3b |
-argsfile @TESTDIR@/slapd.1.args
|
|
|
e4ff3b |
-
|
|
|
e4ff3b |
-# SSL configuration
|
|
|
e4ff3b |
-TLSCACertificateFile @TESTDIR@/tls/ca/certs/testsuiteCA.crt
|
|
|
e4ff3b |
-TLSCertificateKeyFile @TESTDIR@/tls/private/localhost.key
|
|
|
e4ff3b |
-TLSCertificateFile @TESTDIR@/tls/certs/localhost.crt
|
|
|
e4ff3b |
-
|
|
|
e4ff3b |
-#
|
|
|
e4ff3b |
-rootdse @DATADIR@/rootdse.ldif
|
|
|
e4ff3b |
-
|
|
|
e4ff3b |
-#mod#modulepath ../servers/slapd/back-@BACKEND@/
|
|
|
e4ff3b |
-#mod#moduleload back_@BACKEND@.la
|
|
|
e4ff3b |
-#monitormod#modulepath ../servers/slapd/back-monitor/
|
|
|
e4ff3b |
-#monitormod#moduleload back_monitor.la
|
|
|
e4ff3b |
-
|
|
|
e4ff3b |
-
|
|
|
e4ff3b |
-#######################################################################
|
|
|
e4ff3b |
-# database definitions
|
|
|
e4ff3b |
-#######################################################################
|
|
|
e4ff3b |
-
|
|
|
e4ff3b |
-database @BACKEND@
|
|
|
e4ff3b |
-suffix "dc=example,dc=com"
|
|
|
e4ff3b |
-rootdn "cn=Manager,dc=example,dc=com"
|
|
|
e4ff3b |
-rootpw secret
|
|
|
e4ff3b |
-#~null~#directory @TESTDIR@/db.1.a
|
|
|
e4ff3b |
-#indexdb#index objectClass eq
|
|
|
e4ff3b |
-#indexdb#index mail eq
|
|
|
e4ff3b |
-#ndb#dbname db_1_a
|
|
|
e4ff3b |
-#ndb#include @DATADIR@/ndb.conf
|
|
|
e4ff3b |
-
|
|
|
e4ff3b |
-#monitor#database monitor
|
|
|
e4ff3b |
-
|
|
|
e4ff3b |
-sasl-realm @KRB5REALM@
|
|
|
e4ff3b |
-sasl-host localhost
|
|
|
e4ff3b |
diff --git a/tests/scripts/defines.sh b/tests/scripts/defines.sh
|
|
|
e4ff3b |
index 78dc1f8ae..76c85b442 100755
|
|
|
e4ff3b |
--- a/tests/scripts/defines.sh
|
|
|
e4ff3b |
+++ b/tests/scripts/defines.sh
|
|
|
e4ff3b |
@@ -108,7 +108,6 @@ REFCONSUMERCONF=$DATADIR/slapd-ref-consumer.conf
|
|
|
e4ff3b |
SCHEMACONF=$DATADIR/slapd-schema.conf
|
|
|
e4ff3b |
TLSCONF=$DATADIR/slapd-tls.conf
|
|
|
e4ff3b |
TLSSASLCONF=$DATADIR/slapd-tls-sasl.conf
|
|
|
e4ff3b |
-SASLGSSAPICONF=$DATADIR/slapd-sasl-gssapi.conf
|
|
|
e4ff3b |
GLUECONF=$DATADIR/slapd-glue.conf
|
|
|
e4ff3b |
REFINTCONF=$DATADIR/slapd-refint.conf
|
|
|
e4ff3b |
RETCODECONF=$DATADIR/slapd-retcode.conf
|
|
|
e4ff3b |
diff --git a/tests/scripts/test077-sasl-gssapi b/tests/scripts/test077-sasl-gssapi
|
|
|
e4ff3b |
index bde9006ca..322df60a4 100755
|
|
|
e4ff3b |
--- a/tests/scripts/test077-sasl-gssapi
|
|
|
e4ff3b |
+++ b/tests/scripts/test077-sasl-gssapi
|
|
|
e4ff3b |
@@ -21,15 +21,40 @@ if test $WITH_SASL = no ; then
|
|
|
e4ff3b |
exit 0
|
|
|
e4ff3b |
fi
|
|
|
e4ff3b |
|
|
|
e4ff3b |
-mkdir -p $TESTDIR $DBDIR1
|
|
|
e4ff3b |
+CONFDIR=$TESTDIR/slapd.d
|
|
|
e4ff3b |
+CONFLDIF=$TESTDIR/slapd.ldif
|
|
|
e4ff3b |
+
|
|
|
e4ff3b |
+mkdir -p $TESTDIR $DBDIR1 $CONFDIR
|
|
|
e4ff3b |
cp -r $DATADIR/tls $TESTDIR
|
|
|
e4ff3b |
+$SLAPPASSWD -g -n >$CONFIGPWF
|
|
|
e4ff3b |
|
|
|
e4ff3b |
echo "Starting KDC for SASL/GSSAPI tests..."
|
|
|
e4ff3b |
. $SRCDIR/scripts/setup_kdc.sh
|
|
|
e4ff3b |
|
|
|
e4ff3b |
-echo "Running slapadd to build slapd database..."
|
|
|
e4ff3b |
-. $CONFFILTER $BACKEND $MONITORDB < $SASLGSSAPICONF > $CONF1
|
|
|
e4ff3b |
-$SLAPADD -f $CONF1 -l $LDIFORDERED
|
|
|
e4ff3b |
+echo "Configuring slapd..."
|
|
|
e4ff3b |
+cat > $CONFLDIF <
|
|
|
e4ff3b |
+dn: cn=config
|
|
|
e4ff3b |
+objectClass: olcGlobal
|
|
|
e4ff3b |
+cn: config
|
|
|
e4ff3b |
+olcSaslHost: localhost
|
|
|
e4ff3b |
+olcSaslRealm: $KRB5REALM
|
|
|
e4ff3b |
+olcTLSCACertificateFile: $TESTDIR/tls/ca/certs/testsuiteCA.crt
|
|
|
e4ff3b |
+olcTLSCertificateFile: $TESTDIR/tls/certs/localhost.crt
|
|
|
e4ff3b |
+olcTLSCertificateKeyFile: $TESTDIR/tls/private/localhost.key
|
|
|
e4ff3b |
+
|
|
|
e4ff3b |
+dn: cn=schema,cn=config
|
|
|
e4ff3b |
+objectClass: olcSchemaConfig
|
|
|
e4ff3b |
+cn: schema
|
|
|
e4ff3b |
+
|
|
|
e4ff3b |
+include: file://$ABS_SCHEMADIR/core.ldif
|
|
|
e4ff3b |
+
|
|
|
e4ff3b |
+dn: olcDatabase={0}config,cn=config
|
|
|
e4ff3b |
+objectClass: olcDatabaseConfig
|
|
|
e4ff3b |
+olcDatabase: {0}config
|
|
|
e4ff3b |
+olcRootPW:< file://$TESTDIR/configpw
|
|
|
e4ff3b |
+
|
|
|
e4ff3b |
+EOF
|
|
|
e4ff3b |
+$SLAPADD -F $CONFDIR -n 0 -l $CONFLDIF
|
|
|
e4ff3b |
RC=$?
|
|
|
e4ff3b |
if test $RC != 0 ; then
|
|
|
e4ff3b |
echo "slapadd failed ($RC)!"
|
|
|
e4ff3b |
@@ -38,7 +63,7 @@ if test $RC != 0 ; then
|
|
|
e4ff3b |
fi
|
|
|
e4ff3b |
|
|
|
e4ff3b |
echo "Starting ldap:/// slapd on TCP/IP port $PORT1 and ldaps:/// slapd on $PORT2..."
|
|
|
e4ff3b |
-$SLAPD -f $CONF1 -h "$URI1 $SURI2" -d $LVL $TIMING > $LOG1 2>&1 &
|
|
|
e4ff3b |
+$SLAPD -F $CONFDIR -h "$URI1 $SURI2" -d $LVL $TIMING > $LOG1 2>&1 &
|
|
|
e4ff3b |
PID=$!
|
|
|
e4ff3b |
if test $WAIT != 0 ; then
|
|
|
e4ff3b |
echo PID $PID
|
|
|
e4ff3b |
@@ -141,6 +166,79 @@ else
|
|
|
e4ff3b |
fi
|
|
|
e4ff3b |
fi
|
|
|
e4ff3b |
|
|
|
e4ff3b |
+if test $WITH_TLS = no ; then
|
|
|
e4ff3b |
+ echo "TLS support not available, skipping channe-binding test"
|
|
|
e4ff3b |
+elif test $HAVE_SASL_GSS_CBIND = no ; then
|
|
|
e4ff3b |
+ echo "SASL has no channel-binding support in GSSAPI, test skipped"
|
|
|
e4ff3b |
+else
|
|
|
e4ff3b |
+ echo "Testing SASL/GSSAPI with SASL_CBINDING..."
|
|
|
e4ff3b |
+
|
|
|
e4ff3b |
+ for acb in "none" "tls-unique" "tls-endpoint" ; do
|
|
|
e4ff3b |
+
|
|
|
e4ff3b |
+ echo "Modifying slapd's olcSaslCBinding to ${acb} ..."
|
|
|
e4ff3b |
+ $LDAPMODIFY -D cn=config -H $URI1 -y $CONFIGPWF <<EOF > $TESTOUT 2>&1
|
|
|
e4ff3b |
+dn: cn=config
|
|
|
e4ff3b |
+changetype: modify
|
|
|
e4ff3b |
+replace: olcSaslCBinding
|
|
|
e4ff3b |
+olcSaslCBinding: ${acb}
|
|
|
e4ff3b |
+EOF
|
|
|
e4ff3b |
+ RC=$?
|
|
|
e4ff3b |
+ if test $RC != 0 ; then
|
|
|
e4ff3b |
+ echo "ldapmodify failed ($RC)!"
|
|
|
e4ff3b |
+ kill $KDCPROC
|
|
|
e4ff3b |
+ test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
|
|
e4ff3b |
+ exit $RC
|
|
|
e4ff3b |
+ fi
|
|
|
e4ff3b |
+
|
|
|
e4ff3b |
+ for icb in "none" "tls-unique" "tls-endpoint" ; do
|
|
|
e4ff3b |
+
|
|
|
e4ff3b |
+ # The gnutls implemantation of "tls-unique" seems broken
|
|
|
e4ff3b |
+ if test $icb = "tls-unique" -o $acb = "tls-unique" ; then
|
|
|
e4ff3b |
+ if test $WITH_TLS_TYPE == gnutls ; then
|
|
|
e4ff3b |
+ continue
|
|
|
e4ff3b |
+ fi
|
|
|
e4ff3b |
+ fi
|
|
|
e4ff3b |
+
|
|
|
e4ff3b |
+ fail="no"
|
|
|
e4ff3b |
+ if test $icb != $acb -a $acb != "none" ; then
|
|
|
e4ff3b |
+ # This currently fails in MIT, but it is planned to be
|
|
|
e4ff3b |
+ # fixed not to fail like in heimdal - avoid testing.
|
|
|
e4ff3b |
+ if test $icb = "none" ; then
|
|
|
e4ff3b |
+ continue
|
|
|
e4ff3b |
+ fi
|
|
|
e4ff3b |
+ # Otherwise unmatching bindings are expected to fail.
|
|
|
e4ff3b |
+ fail="yes"
|
|
|
e4ff3b |
+ fi
|
|
|
e4ff3b |
+
|
|
|
e4ff3b |
+ echo -n "Using ldapwhoami with SASL/GSSAPI and SASL_CBINDING "
|
|
|
e4ff3b |
+ echo -ne "(client: ${icb},\tserver: ${acb}): "
|
|
|
e4ff3b |
+
|
|
|
e4ff3b |
+ $LDAPSASLWHOAMI -N -Y GSSAPI -H $URI1 -ZZ -o tls_reqcert=allow \
|
|
|
e4ff3b |
+ -o tls_cacert=$TESTDIR/tls/ca/certs/testsuiteCA.crt \
|
|
|
e4ff3b |
+ -o SASL_CBINDING=$icb > $TESTOUT 2>&1
|
|
|
e4ff3b |
+
|
|
|
e4ff3b |
+ RC=$?
|
|
|
e4ff3b |
+ if test $RC != 0 ; then
|
|
|
e4ff3b |
+ if test $fail = "no" ; then
|
|
|
e4ff3b |
+ echo "test failed ($RC)!"
|
|
|
e4ff3b |
+ kill $KDCPROC
|
|
|
e4ff3b |
+ test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
|
|
e4ff3b |
+ exit $RC
|
|
|
e4ff3b |
+ fi
|
|
|
e4ff3b |
+ elif test $fail = "yes" ; then
|
|
|
e4ff3b |
+ echo "failed: command succeeded unexpectedly."
|
|
|
e4ff3b |
+ kill $KDCPROC
|
|
|
e4ff3b |
+ test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
|
|
e4ff3b |
+ exit 1
|
|
|
e4ff3b |
+ fi
|
|
|
e4ff3b |
+
|
|
|
e4ff3b |
+ echo "success"
|
|
|
e4ff3b |
+ RC=0
|
|
|
e4ff3b |
+ done
|
|
|
e4ff3b |
+ done
|
|
|
e4ff3b |
+fi
|
|
|
e4ff3b |
+
|
|
|
e4ff3b |
+
|
|
|
e4ff3b |
kill $KDCPROC
|
|
|
e4ff3b |
test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
|
|
e4ff3b |
|
|
|
e4ff3b |
--
|
|
|
e4ff3b |
2.29.2
|
|
|
e4ff3b |
|