summaryrefslogtreecommitdiff
path: root/tests/basic
blob: 7d354f9a92d39fc7f351ccbb8be1bb2edb8b06fc (plain)
  1. #!/usr/bin/env bash
  2. # Tests to ensure that the monkeysphere is working
  3. # Author: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
  4. # Date: 2008-09-13 13:40:15-0400
  5. # these tests might be best run under fakeroot, particularly the
  6. # "server-side" tests. Using fakeroot, they should be able to be run
  7. # as a non-privileged user.
  8. # NOTE: these tests have *not* themselves been tested yet
  9. # (2008-09-13). Please exercise with caution!
  10. # these tests assume a commonly-trusted "Admin's key", a fake key
  11. # permanently stored in ./admin:
  12. gpgadmin() {
  13. GNUPGHOME=./admin gpg "$@"
  14. }
  15. # cleanup:
  16. cleanup() {
  17. rm -f ./ssh-socket
  18. # FIXME: how should we clear out the temporary $VARLIB?
  19. # FIXME: clear out ssh client config file and known hosts.
  20. }
  21. ## set up some variables to ensure that we're operating strictly in
  22. ## the tests, not system-wide:
  23. # FIXME: can we override $VARLIB ?
  24. # FIXME: can we override $ETC ?
  25. # Use the local copy of executables first, instead of system ones.
  26. # This should help us test without installing.
  27. export PATH=$(pwd)/../src:$(pwd)/../src/keytrans:$PATH
  28. export MONKEYSPHERE_SHARE=$(pwd)/../src
  29. # create a new host key, certify it with the "Admin's Key".
  30. echo | monkeysphere-server gen-key --expire 2d
  31. HOSTKEYID=$( monkeysphere-server show-key | tail -n1 | cut -f3 -d\ )
  32. monkeysphere-server gpg-authentication-cmd "--armor --export $HOSTKEYID" | gpgadmin --import
  33. gpgadmin --sign-key "$HOSTKEYID"
  34. # FIXME: how can we test publish-key without flooding junk into the
  35. # keyservers?
  36. # indicate that the "Admin's" key is an identity certifier for the
  37. # host
  38. monkeysphere-server add-identity-certifier ./admin/pubkey.gpg
  39. # launch sshd with the new host key.
  40. mkfifo ./ssh-socket
  41. sshd -f ./sshd_config -i <>./ssh-socket
  42. # connect to sample sshd host key, using monkeysphere to verify the
  43. # identity before connection.
  44. ## FIXME: implement!
  45. # create a new client side key, certify it with the "CA", use it to
  46. # log in.
  47. ## FIXME: implement!