X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=tests%2Fbasic;h=c3d3208ce58463eb62a636766d47455a6f8e6974;hb=047780def321f18898c58dcc0e94e09a4b40f465;hp=6d0a8888b989aaf1c92321208a92857c391ca3f5;hpb=6923ef580f068ff535af273714e59235260ab7b6;p=monkeysphere.git diff --git a/tests/basic b/tests/basic index 6d0a888..c3d3208 100755 --- a/tests/basic +++ b/tests/basic @@ -19,7 +19,7 @@ set -o pipefail ## make sure that the right tools are installed to run the test. the ## test has *more* requirements than plain ol' monkeysphere: -which socat || { echo "You must have socat installed to run this test." ; exit 1; } +which socat >/dev/null || { echo "You must have socat installed to run this test." ; exit 1; } ## FIXME: other checks? @@ -107,7 +107,7 @@ trap failed_cleanup EXIT ## set up some variables to ensure that we're operating strictly in ## the tests, not system-wide: -export TESTDIR=$(pwd) +export TESTDIR=$(dirname "$0") # make temp dir TEMPDIR="$TESTDIR"/tmp @@ -123,7 +123,7 @@ export PATH="$TESTDIR"/../src:"$TESTDIR"/../src/keytrans:"$PATH" export MONKEYSPHERE_SYSDATADIR="$TEMPDIR" export MONKEYSPHERE_SYSCONFIGDIR="$TEMPDIR" -export MONKEYSPHERE_SYSSHAREDIR="$TESTDIR"/../src +export MONKEYSPHERE_SYSSHAREDIR="$TESTDIR"/../src/share export MONKEYSPHERE_MONKEYSPHERE_USER=$(whoami) export MONKEYSPHERE_CHECK_KEYSERVER=false export MONKEYSPHERE_LOG_LEVEL=DEBUG @@ -161,50 +161,55 @@ get_gpg_prng_arg >> "$GNUPGHOME"/gpg.conf # set up sshd echo "### configuring sshd..." -cp etc/ssh/sshd_config "$SSHD_CONFIG" +cp "$TESTDIR"/etc/ssh/sshd_config "$SSHD_CONFIG" # write the sshd_config cat <> "$SSHD_CONFIG" HostKey ${MONKEYSPHERE_SYSDATADIR}/ssh_host_rsa_key AuthorizedKeysFile ${MONKEYSPHERE_SYSDATADIR}/authentication/authorized_keys/%u EOF -# set up monkeysphere-server -echo "### configuring monkeysphere..." -mkdir -p -m 750 "$MONKEYSPHERE_SYSDATADIR"/host -mkdir -p -m 700 "$MONKEYSPHERE_SYSDATADIR"/authentication -mkdir -p -m 700 "$MONKEYSPHERE_SYSDATADIR"/authentication/authorized_keys -mkdir -p -m 700 "$MONKEYSPHERE_SYSDATADIR"/tmp -cp etc/monkeysphere/monkeysphere-server.conf "$TEMPDIR"/monkeysphere-server.conf -cat <> "$TEMPDIR"/monkeysphere-server.conf -AUTHORIZED_USER_IDS="$MONKEYSPHERE_HOME/authentication/authorized_user_ids" -EOF -cat < "$MONKEYSPHERE_SYSDATADIR"/gnupg-authentication/gpg.conf -primary-keyring ${MONKEYSPHERE_SYSDATADIR}/authentication/sphere/pubring.gpg -keyring ${MONKEYSPHERE_SYSDATADIR}/host/pubring.gpg -EOF +### SERVER HOST SETUP -### SERVER TESTS +# set up monkeysphere host +echo "### configuring monkeysphere host..." +mkdir -p -m 750 "$MONKEYSPHERE_SYSDATADIR"/host # create a new host key -echo "### generating server key..." +echo "### generating server host key..." # add gpg.conf with quick-random -get_gpg_prng_arg >> "$MONKEYSPHERE_SYSCONFIGDIR"/gnupg-host/gpg.conf +get_gpg_prng_arg >> "$MONKEYSPHERE_SYSCONFIGDIR"/host/gpg.conf echo | monkeysphere-host expert gen-key --length 1024 --expire 0 testhost # remove the gpg.conf -rm "$MONKEYSPHERE_SYSCONFIGDIR"/gnupg-host/gpg.conf +rm "$MONKEYSPHERE_SYSCONFIGDIR"/host/gpg.conf HOSTKEYID=$( monkeysphere-host show-key | grep '^OpenPGP fingerprint: ' | cut -f3 -d\ ) # certify it with the "Admin's Key". # (this would normally be done via keyservers) -echo "### certifying server key..." -monkeysphere-authentication expert gpg-cmd "--armor --export $HOSTKEYID" | gpgadmin --import +echo "### certifying server host key..." +GNUPGHOME="$MONKEYSPHERE_SYSCONFIGDIR"/host gpg --armor --export "$HOSTKEYID" | gpgadmin --import echo y | gpgadmin --command-fd 0 --sign-key "$HOSTKEYID" # FIXME: how can we test publish-key without flooding junk into the # keyservers? + +### SERVER AUTHENTICATION TESTS + +# set up monkeysphere authentication +echo "### configuring monkeysphere authentication..." +mkdir -p -m 700 "$MONKEYSPHERE_SYSDATADIR"/authentication/{authorized_keys,core,sphere,tmp} +cp "$TESTDIR"/etc/monkeysphere/monkeysphere-authentication.conf "$TEMPDIR"/ +cat <> "$TEMPDIR"/monkeysphere-authentication.conf +AUTHORIZED_USER_IDS="$MONKEYSPHERE_HOME/authentication/authorized_user_ids" +EOF + +# setup server authentication +echo "### setting up server authentication..." +monkeysphere-authentication setup +get_gpg_prng_arg >> "$MONKEYSPHERE_SYSDATADIR"/authentication/sphere/gpg.conf + # add admin as identity certifier for testhost echo "### adding admin as certifier..." echo y | monkeysphere-authentication add-id-certifier "$TEMPDIR"/admin/.gnupg/pubkey.gpg