3 # Tests to ensure that the monkeysphere is working
5 # Author: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
6 # Date: 2008-09-13 13:40:15-0400
8 # these tests might be best run under fakeroot, particularly the
9 # "server-side" tests. Using fakeroot, they should be able to be run
10 # as a non-privileged user.
12 # NOTE: these tests have *not* themselves been tested yet
13 # (2008-09-13). Please exercise with caution!
15 # these tests assume a commonly-trusted "Admin's key", a fake key
16 # permanently stored in ./admin:
19 GNUPGHOME=./admin gpg "$@"
26 # FIXME: stop the sshd process
30 # FIXME: how should we clear out the temporary $VARLIB?
32 # FIXME: clear out ssh client config file and known hosts.
35 ## set up some variables to ensure that we're operating strictly in
36 ## the tests, not system-wide:
39 export MONKEYSPHERE_SYSDATADIR="$TESTDIR"/var
40 export MONKEYSPHERE_SYSCONFIGDIR="$TESTDIR"/etc
41 export SOCKET="$TESTDIR"/ssh-socket
45 # Use the local copy of executables first, instead of system ones.
46 # This should help us test without installing.
47 export PATH="$TESTDIR"/../src:"$TESTDIR"/../src/keytrans:"$PATH"
48 export MONKEYSPHERE_SHARE="$TESTDIR"/../src
50 # create a new host key
52 echo | monkeysphere-server gen-key --expire 2d
54 HOSTKEYID=$( monkeysphere-server show-key | tail -n1 | cut -f3 -d\ )
56 # certify it with the "Admin's Key".
57 # (this would normally be done via keyservers)
58 monkeysphere-server gpg-authentication-cmd "--armor --export $HOSTKEYID" | gpgadmin --import
60 gpgadmin --sign-key "$HOSTKEYID"
62 # FIXME: how can we test publish-key without flooding junk into the
65 # indicate that the "Admin's" key is an identity certifier for the
68 monkeysphere-server add-identity-certifier ./home/admin/.gnupg/pubkey.gpg
70 # write the sshd_config
71 cat <<EOF > "$TESTDIR"/etc/ssh/sshd_config
72 HostKey ${TESTDIR}/etc/ssh/ssh_host_rsa_key
75 # launch sshd with the new host key.
79 /usr/sbin/sshd -f "$TESTDIR"/etc/ssh/sshd_config -i <>"$SOCKET"
85 # connect to sample sshd host key, using monkeysphere to verify the
86 # identity before connection.
90 # create a new client side key, certify it with the "CA", use it to