Merge commit 'dkg/master'
[monkeysphere.git] / tests / basic
1 #!/usr/bin/env bash
2
3 # Tests to ensure that the monkeysphere is working
4
5 # Author: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
6 # Date: 2008-09-13 13:40:15-0400
7
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.
11
12 # NOTE: these tests have *not* themselves been tested yet
13 # (2008-09-13).  Please exercise with caution!
14
15 # these tests assume a commonly-trusted "Admin's key", a fake key
16 # permanently stored in ./admin:
17
18 gpgadmin() {
19     GNUPGHOME=./admin gpg "$@"
20 }
21
22
23 # cleanup:
24
25 cleanup() {
26     rm -f ./ssh-socket
27
28     # FIXME: how should we clear out the temporary $VARLIB?
29
30     # FIXME: clear out ssh client config file and known hosts.
31 }
32
33 ## set up some variables to ensure that we're operating strictly in
34 ## the tests, not system-wide:
35
36 # FIXME: can we override $VARLIB ?
37 # FIXME: can we override $ETC ?
38
39 # Use the local copy of executables first, instead of system ones.
40 # This should help us test without installing.
41 export PATH=$(pwd)/../src:$(pwd)/../src/keytrans:$PATH
42 export MONKEYSPHERE_SHARE=$(pwd)/../src
43
44 # create a new host key, certify it with the "Admin's Key".
45
46 echo | monkeysphere-server gen-key --expire 2d
47
48 HOSTKEYID=$( monkeysphere-server show-key | tail -n1 | cut -f3 -d\  )
49
50 monkeysphere-server gpg-authentication-cmd "--armor --export $HOSTKEYID" | gpgadmin --import
51
52 gpgadmin --sign-key "$HOSTKEYID"
53
54 # FIXME: how can we test publish-key without flooding junk into the
55 # keyservers?
56
57 # indicate that the "Admin's" key is an identity certifier for the
58 # host
59
60 monkeysphere-server add-identity-certifier ./admin/pubkey.gpg
61
62 # launch sshd with the new host key.
63
64 mkfifo ./ssh-socket
65
66 sshd -f ./sshd_config -i <>./ssh-socket
67
68 # connect to sample sshd host key, using monkeysphere to verify the
69 # identity before connection.
70
71 ## FIXME: implement!
72
73 # create a new client side key, certify it with the "CA", use it to
74 # log in.
75
76 ## FIXME: implement!
77
78