aboutsummaryrefslogtreecommitdiff
path: root/tests/client/rekey-t.in
diff options
context:
space:
mode:
authorRuss Allbery <rra@stanford.edu>2010-07-29 17:36:30 -0700
committerRuss Allbery <rra@stanford.edu>2010-07-29 17:36:30 -0700
commit7a1d4f9e4b96362edef29f71e848458d619cce3b (patch)
treefc0854a7e9b59e4e365fade4942953a37f32f4bd /tests/client/rekey-t.in
parentad2639b8eae05c620e212fbd01fb34b728a55cc4 (diff)
Add an initial test for wallet-rekey
This confirms basic functionality, but doesn't test more interesting things like rekeying multiple keys in the same keytab or skipping principals that aren't from the local realm.
Diffstat (limited to 'tests/client/rekey-t.in')
-rw-r--r--tests/client/rekey-t.in65
1 files changed, 65 insertions, 0 deletions
diff --git a/tests/client/rekey-t.in b/tests/client/rekey-t.in
new file mode 100644
index 0000000..9127f6c
--- /dev/null
+++ b/tests/client/rekey-t.in
@@ -0,0 +1,65 @@
+#! /bin/sh
+#
+# Test suite for the wallet-rekey command-line client.
+#
+# Written by Russ Allbery <rra@stanford.edu>
+# Copyright 2006, 2007, 2008, 2010
+# Board of Trustees, Leland Stanford Jr. University
+#
+# See LICENSE for licensing terms.
+
+# Load the test library.
+. "$SOURCE/tap/libtap.sh"
+. "$SOURCE/tap/kerberos.sh"
+. "$SOURCE/tap/remctl.sh"
+cd "$SOURCE"
+
+# We need a modified krb5.conf file to test wallet configuration settings in
+# krb5.conf. Despite the hard-coding of test-k5.stanford.edu, this test isn't
+# Stanford-specific; it just matches the files that are distributed with the
+# package.
+krb5conf=
+for p in /etc/krb5.conf /usr/local/etc/krb5.conf data/krb5.conf ; do
+ if [ -r "$p" ] ; then
+ krb5conf="$p"
+ sed -e '/^[ ]*test-k5.stanford.edu =/,/}/d' \
+ -e 's/\(default_realm.*=\) .*/\1 test-k5.stanford.edu/' \
+ -e 's/^[ ]*wallet_.*//' \
+ -e '/^[ ]*wallet[ ]*=[ ]*{/,/}/d' \
+ "$p" > ./krb5.conf
+ KRB5_CONFIG="./krb5.conf"
+ export KRB5_CONFIG
+ break
+ fi
+done
+if [ -z "$krb5conf" ] ; then
+ skip_all 'no krb5.conf found, put one in tests/data/krb5.conf'
+fi
+
+# Test setup.
+kerberos_setup
+if [ $? != 0 ] ; then
+ rm krb5.conf
+ skip_all 'Kerberos tests not configured'
+elif [ -z '@REMCTLD@' ] ; then
+ rm krb5.conf
+ skip_all 'No remctld found'
+else
+ plan 2
+fi
+remctld_start '@REMCTLD@' "$SOURCE/data/basic.conf"
+wallet="$BUILD/../client/wallet-rekey"
+
+# Rekeying should result in a merged keytab with both the old and new keys.
+cp data/fake-keytab-old keytab
+ok_program '' 0 '' \
+ "$wallet" -k "$principal" -p 14373 -s localhost -c fake-wallet keytab
+ktutil_list keytab klist-seen
+ktutil_list data/fake-keytab-rekey klist-good
+ok '...and the rekeyed keytab is correct' cmp klist-seen klist-good
+rm -f keytab klist-good klist-seen
+
+# Clean up.
+rm -f autocreated krb5.conf
+remctld_stop
+kerberos_cleanup