2 # This should be sourced by bash (though we welcome changes to make it POSIX sh compliant)
4 # Monkeysphere host publish-key subcommand
6 # The monkeysphere scripts are written by:
7 # Jameson Rollins <jrollins@finestructure.net>
8 # Jamie McClelland <jm@mayfirst.org>
9 # Daniel Kahn Gillmor <dkg@fifthhorseman.net>
11 # They are Copyright 2008-2009, and are all released under the GPL, version 3
14 # publish server key to keyserver
20 if [ "$PROMPT" = "true" ] ; then
21 printf "Really publish host key to $KEYSERVER? (Y/n) " >&2
23 if [ "${OK/y/Y}" != 'Y' ] ; then
24 failure "key not published."
27 log debug "publishing key without prompting."
30 # create a temporary gnupg directory from which to publish the key
31 export GNUPGHOME=$(msmktempdir)
32 chmod 0700 "$GNUPGHOME"
33 chown "$MONKEYSPHERE_USER":"$MONKEYSPHERE_GROUP" "$GNUPGHOME"
35 # trap to remove tmp dir if break
36 trap "rm -rf $GNUPGHOME" EXIT
38 # import the host key into the tmp dir
39 su_monkeysphere_user \
40 "gpg --quiet --import" <"$HOST_KEY_FILE"
43 su_monkeysphere_user \
44 "gpg --keyserver $KEYSERVER --send-keys '0x${HOST_FINGERPRINT}!'"