From d6632fcdded8d1c9bf1b75e8df57b613f3f704b6 Mon Sep 17 00:00:00 2001 From: Jameson Graef Rollins Date: Mon, 13 Oct 2008 20:22:47 -0400 Subject: [PATCH] More work on test suite. --- tests/basic | 60 ++++++++++++++++--------- tests/home/admin/.gnupg/pubkey.gpg | Bin 0 -> 417 bytes tests/home/testuser/.gnupg/pubring.gpg | Bin 0 -> 405 bytes tests/home/testuser/.gnupg/random_seed | Bin 0 -> 600 bytes tests/home/testuser/.gnupg/secring.gpg | Bin 0 -> 737 bytes tests/home/testuser/.gnupg/trustdb.gpg | Bin 0 -> 1280 bytes 6 files changed, 40 insertions(+), 20 deletions(-) create mode 100644 tests/home/admin/.gnupg/pubkey.gpg create mode 100644 tests/home/testuser/.gnupg/pubring.gpg create mode 100644 tests/home/testuser/.gnupg/random_seed create mode 100644 tests/home/testuser/.gnupg/secring.gpg create mode 100644 tests/home/testuser/.gnupg/trustdb.gpg diff --git a/tests/basic b/tests/basic index ff897d2..4daaf29 100755 --- a/tests/basic +++ b/tests/basic @@ -13,50 +13,63 @@ # (2008-09-13). Please exercise with caution! # these tests assume a commonly-trusted "Admin's key", a fake key -# permanently stored in ./admin: - +# permanently stored in ./home/admin/.gnupg: gpgadmin() { - GNUPGHOME=./admin gpg "$@" + GNUPGHOME="$TESTDIR"/home/admin/.gnupg gpg "$@" } # cleanup: - cleanup() { # FIXME: stop the sshd process - rm -f "$SOCKET" + echo + echo "-- removing temp dir..." + rm -rf "$TEMPDIR" # FIXME: how should we clear out the temporary $VARLIB? # FIXME: clear out ssh client config file and known hosts. } +## setup trap +#trap cleanup EXIT + ## set up some variables to ensure that we're operating strictly in ## the tests, not system-wide: -TESTDIR=$(pwd) -export MONKEYSPHERE_SYSDATADIR="$TESTDIR"/var -export MONKEYSPHERE_SYSCONFIGDIR="$TESTDIR"/etc -export SOCKET="$TESTDIR"/ssh-socket +export TESTDIR=$(pwd) -### SERVER TESTS +# make temp dir +TEMPDIR="$TESTDIR"/tmp +mkdir "$TEMPDIR" # Use the local copy of executables first, instead of system ones. # This should help us test without installing. export PATH="$TESTDIR"/../src:"$TESTDIR"/../src/keytrans:"$PATH" -export MONKEYSPHERE_SHARE="$TESTDIR"/../src -# create a new host key +export MONKEYSPHERE_SYSDATADIR="$TEMPDIR" +export MONKEYSPHERE_SYSCONFIGDIR="$TEMPDIR" +export MONKEYSPHERE_SYSSHAREDIR="$TESTDIR"/../src +export MONKEYSPHERE_MONKEYSPHERE_USER="$USER" +export SOCKET="$TEMPDIR"/ssh-socket + +### SERVER TESTS -echo | monkeysphere-server gen-key --expire 2d +# create the temp gnupghome directories +mkdir -p -m 750 "$MONKEYSPHERE_SYSDATADIR"/gnupg-host +mkdir -p -m 700 "$MONKEYSPHERE_SYSDATADIR"/gnupg-authentication + +# create a new host key +echo "-- generating server key..." +echo | monkeysphere-server gen-key --length 1024 --expire 0 HOSTKEYID=$( monkeysphere-server show-key | tail -n1 | cut -f3 -d\ ) # certify it with the "Admin's Key". # (this would normally be done via keyservers) +echo "-- certifying server key..." monkeysphere-server gpg-authentication-cmd "--armor --export $HOSTKEYID" | gpgadmin --import - gpgadmin --sign-key "$HOSTKEYID" # FIXME: how can we test publish-key without flooding junk into the @@ -65,22 +78,29 @@ gpgadmin --sign-key "$HOSTKEYID" # indicate that the "Admin's" key is an identity certifier for the # host -monkeysphere-server add-identity-certifier ./home/admin/.gnupg/pubkey.gpg +echo "-- adding admin as certifier..." +monkeysphere-server add-identity-certifier "$TESTDIR"/home/admin/.gnupg/pubkey.gpg # write the sshd_config -cat < "$TESTDIR"/etc/ssh/sshd_config -HostKey ${TESTDIR}/etc/ssh/ssh_host_rsa_key +cat < "$TEMPDIR"/sshd_config +HostKey ${MONKEYSPHERE_SYSDATADIR}/ssh_host_rsa_key EOF # launch sshd with the new host key. - +echo "-- starting sshd..." mkfifo "$SOCKET" +/usr/sbin/sshd -f "$TEMPDIR"/sshd_config -i <>"$SOCKET" -/usr/sbin/sshd -f "$TESTDIR"/etc/ssh/sshd_config -i <>"$SOCKET" +### TESTUSER TESTS +# copy testuser home directory into temp dir +cp -r "$TESTDIR"/home/testuser "$TEMPDIR"/ -### TESTUSER TESTS +# generate an auth subkey for the test user +echo "-- generating key for testuser..." +MONKEYSPHERE_GNUPGHOME="$TEMPDIR"/testuser/.gnupg \ + monkeysphere gen-subkey --expire 0 # connect to sample sshd host key, using monkeysphere to verify the # identity before connection. diff --git a/tests/home/admin/.gnupg/pubkey.gpg b/tests/home/admin/.gnupg/pubkey.gpg new file mode 100644 index 0000000000000000000000000000000000000000..4bbb6b3f5f56e4862735c7a7fb25affbfe6c2410 GIT binary patch literal 417 zcmV;S0bc%?jRZ*X7GVJd0MlCb^% zWqEUOXk~I`AXH^@bRbi8X>?^EMqz7ZAVFkpX>MtAbaG*IX?A5GRdZ!>ASgsnAWlzI zAXQUEAt50tAUtMaYh__%ZE0>mWq4t2aBO8RZe?^nh_(b10RjLZ1p-L%7GVM#0|pBT z2nPcK1Qh}Z0|XWV0|5da0Rk6*0162ZHvf3Da0S!8nV|##lyv*{P@>=3n>}s>nf@I& zrWmTiJEc2_@{QS=Y`il@E9JMS=rzqg^*-lM#)NWMqGCGoR-aXEKw73|Xe#s9o?I^a z7Nt0lfoQK9ikudXB1BtMa4~a(%@po$dzy%2h(Bi%sX!HldIXvHr9}1^^yNpGisxWM LR6D}s&qfWyY-WKytd+Lb^% zWqEUOXk~I`AXH^@bRbi8X>?^ERAqB?AXRf^av&%~PasZDR3KGTMIj*}DIh#_Wpi|O zb7gWsWq4t2aBO8RZe?^nh_(b10RjLZ1p-L(0|pBT2nPcK1Qh}Z0|XWV0|5da z0Rk6*0162Z;0s>vx_PvMIhq6iS7zD~JAqB6{|QbTw9mCr&+}m}p==arWhQ4EU|`D2 z_kYhmC9#nO3IjJbphJI0u<#>x4Y)};BXm4(nrn2zi+zB`s+!+*5;vM>ZKE=Bs8aP% zkuWKO)8*=qz0+fBTVxyCh4`_j%;LSgMdq) z!Bbcenk47}z;=AX5&Wu&&uc8>YXx{i;M$$=TGQl7sf0y!aN(=poRfiK@K0@;$ zg={4Tt_(U^U527Vj8~LjOel(^cOt}WUeBPP6<;xqg<|4FzLWNaPV)8Xf77@IZ%fxD z=fybc4U9pNs^P-kOjf2hwfBiQ-ZU@_585;gmU^XZnF%G74BFf?y+Fk3y=g+46-I5u z0m@t+;HDV?K#}m3uK{%K@b0{ysxxJoOuyX%p46nUI$V>v`7TCY&w!k}PL0@o<(05H z1f9;lPfB&D&2q(cSUH#0M6?FQyjq|X%bj>|Zz>1hW_pCO&M>;8fC4r#h zL;!SH`-){N3$7C)5-rYo`qUGhMSUTC=Z|Cn$54{=cE$gaFOCIe>J?Q`O2AA&5_9Y{ zJ$+UMnvaR)c0p@pKw@w^te2-V4g%h)Oz`9*8dGjEadGZh)sR7h=At=Ha{Dg%MIH-pSw+~6Debit`ytfX6R{a9yH m6AI#FGC|6!sw_ZtpO69`1Ov_fpPS1Y{}S~^QP^i3ufhT-yd?<$ literal 0 HcmV?d00001 diff --git a/tests/home/testuser/.gnupg/secring.gpg b/tests/home/testuser/.gnupg/secring.gpg new file mode 100644 index 0000000000000000000000000000000000000000..a5519a6c68e0310fe7f5979c26c50b0641b2d705 GIT binary patch literal 737 zcmV<70v`R90oVjc^W;eZ1OT~>q|`ZvNJDANJ0a}{Olor8SvUlJnDKp}=vK@HqF@BOxZ%wNBF5x0&6n#~rt}+PxunNCyBB0RRC21O7iL zwNpIhw!Q7IPFV)oDb+@cecBB09FgE61;ZUn<^~v0PO-j_wiG?sZPEBeCH|yMi8V%p z*$Z-YN-jpEi_yuaQ|ITbH&HW$VZzgFNeUizKa|*T=3{)ANUh}W>VsIX74!7FrPnZ{XQaLA1b^%WqEUOXk~I`AXH^@bRbi8X>?^ERAqB?AXRf^av&%~ zPasZDR3KGTMIj*}DIh#_Wpi|Ob7gWsWq4t2aBO8RZe?^nh_(b10RjLZ1p-L( z0|pBT2nPcK1Qh}Z0|XWV0|5da0Rk6*0162Z;0s>vx_PvMIhq6iS7zD~JAqB6{|QbT zw9mCr&+}m}p==arWhQ4EU|`D2_kYhmC9#nO3IjJbphJI0u<#>x4Y)};BXm4(nrn2z zi+zB`s+!+*5;vM>ZKE=Bs8aP%kuWKO)8*=qz0+fBTVxyCh4`_j%;LSgMdq- literal 0 HcmV?d00001 -- 2.26.2