diff options
author | Jameson Graef Rollins <jrollins@finestructure.net> | 2009-02-08 23:59:35 -0500 |
---|---|---|
committer | Jameson Graef Rollins <jrollins@finestructure.net> | 2009-02-08 23:59:35 -0500 |
commit | 770f45b0c1d72a1bb89fd98fe070a6dfdcc4c0bf (patch) | |
tree | bdc3d81acc860b08f07e00695c9c1206fe1b3247 /tests | |
parent | 9cc92238a9a9b21d37b983932d5a6a012cf80aba (diff) | |
parent | 7485d66be9e4aebaf273b8b4082caa4c2404f6e7 (diff) |
Merge commit 'dkg/master'
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/basic | 19 | ||||
-rw-r--r-- | tests/etc/monkeysphere/monkeysphere-authentication.conf | 2 | ||||
-rwxr-xr-x | tests/home/testuser/.ssh/proxy-command | 3 | ||||
-rwxr-xr-x | tests/keytrans | 8 |
4 files changed, 20 insertions, 12 deletions
diff --git a/tests/basic b/tests/basic index 5c6b4bb..d9399f0 100755 --- a/tests/basic +++ b/tests/basic @@ -17,7 +17,8 @@ set -e # piped commands should return the code of the first non-zero return set -o pipefail -export TESTDIR=$(dirname "$0") +# make sure the TESTDIR is an absolute path, not a relative one. +export TESTDIR=$(cd $(dirname "$0") && pwd) source "$TESTDIR"/common @@ -32,6 +33,7 @@ which socat >/dev/null || { echo "You must have socat installed to run this test # gpg command for test admin user gpgadmin() { + chmod 0700 "$TEMPDIR"/admin GNUPGHOME="$TEMPDIR"/admin/.gnupg gpg "$@" } @@ -89,12 +91,8 @@ trap failed_cleanup EXIT ## the tests, not system-wide: # make temp dir -TEMPDIR="$TESTDIR"/tmp -if [ -e "$TEMPDIR" ] ; then - echo "tempdir '$TEMPDIR' already exists." - exit 1 -fi -mkdir -p "$TEMPDIR" +mkdir -p "$TESTDIR"/tmp +TEMPDIR=$(mktemp -d "${TMPDIR:-$TESTDIR/tmp}/monkeyspheretest.XXXXXXX") # Use the local copy of executables first, instead of system ones. # This should help us test without installing. @@ -130,6 +128,7 @@ cp -a "$TESTDIR"/home/testuser "$TEMPDIR"/ # set up environment for testuser export TESTHOME="$TEMPDIR"/testuser export GNUPGHOME="$TESTHOME"/.gnupg +chmod 0700 "$GNUPGHOME" export SSH_ASKPASS="$TESTHOME"/.ssh/askpass export MONKEYSPHERE_HOME="$TESTHOME"/.monkeysphere cat <<EOF >> "$TESTHOME"/.ssh/config @@ -207,7 +206,7 @@ echo "##################################################" echo "### setup monkeysphere authentication..." cp "$TESTDIR"/etc/monkeysphere/monkeysphere-authentication.conf "$TEMPDIR"/ cat <<EOF >> "$TEMPDIR"/monkeysphere-authentication.conf -AUTHORIZED_USER_IDS="$MONKEYSPHERE_HOME/authentication/authorized_user_ids" +AUTHORIZED_USER_IDS="$MONKEYSPHERE_HOME/authorized_user_ids" EOF monkeysphere-authentication setup get_gpg_prng_arg >> "$MONKEYSPHERE_SYSDATADIR"/authentication/sphere/gpg.conf @@ -236,7 +235,7 @@ gpgadmin --armor --export "$HOSTKEYID" | gpg --import # teach the "server" about the testuser's key echo "##################################################" echo "### export testuser key to server..." -gpg --export testuser | monkeysphere-authentication gpg-cmd --import +gpg --export testuser | monkeysphere-authentication expert gpg-cmd --import # update authorized_keys for user echo "##################################################" @@ -247,7 +246,7 @@ monkeysphere-authentication update-users $(whoami) ###################################################################### ### TESTS -# connect to test sshd, using monkeysphere-ssh-proxycommand to verify +# connect to test sshd, using monkeysphere ssh-proxycommand to verify # the identity before connection. This should work in both directions! echo "##################################################" echo "### ssh connection test for success..." diff --git a/tests/etc/monkeysphere/monkeysphere-authentication.conf b/tests/etc/monkeysphere/monkeysphere-authentication.conf index 9cc396f..b4ecc05 100644 --- a/tests/etc/monkeysphere/monkeysphere-authentication.conf +++ b/tests/etc/monkeysphere/monkeysphere-authentication.conf @@ -1,4 +1,4 @@ -# Base monkeysphere-server.conf for monkeysphere tests +# Base monkeysphere-authentication.conf for monkeysphere tests # AUTHORIZED_USER_IDS variable will be added dynamically during test. diff --git a/tests/home/testuser/.ssh/proxy-command b/tests/home/testuser/.ssh/proxy-command index 21c66fa..214cc23 100755 --- a/tests/home/testuser/.ssh/proxy-command +++ b/tests/home/testuser/.ssh/proxy-command @@ -3,6 +3,7 @@ # simple socket-based proxy-command wrapper for testing monkeysphere. # pass this thing the host, the port, and the socket. +which monkeysphere >&2 -monkeysphere-ssh-proxycommand --no-connect "$1" "$2" && \ +monkeysphere ssh-proxycommand --no-connect "$1" "$2" && \ exec socat STDIO UNIX:"$3" diff --git a/tests/keytrans b/tests/keytrans index e1ccda5..285d17b 100755 --- a/tests/keytrans +++ b/tests/keytrans @@ -78,3 +78,11 @@ diff -u \ <(PEM2OPENPGP_USAGE_FLAGS=sign,certify \ PEM2OPENPGP_TIMESTAMP="$timestamp" pem2openpgp testtest < \ "$TEMPDIR"/test.pem | hd ) + +trap - EXIT + +echo "##################################################" +echo " Monkeysphere keytrans test completed successfully!" +echo "##################################################" + +cleanup |