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 read -p "Really publish host key to $KEYSERVER? (Y/n) " OK; OK=${OK:=Y}
22 if [ "${OK/y/Y}" != 'Y' ] ; then
23 failure "key not published."
26 log debug "publishing key without prompting."
29 # create a temporary gnupg directory from which to publish the key
30 export GNUPGHOME=$(msmktempdir)
31 chmod 0700 "$GNUPGHOME"
32 chown "$MONKEYSPHERE_USER":"$MONKEYSPHERE_USER" "$GNUPGHOME"
34 # trap to remove tmp dir if break
35 trap "rm -rf $GNUPGHOME" EXIT
37 # import the host key into the tmp dir
38 su_monkeysphere_user \
39 "gpg --quiet --import" <"$HOST_KEY_FILE"
42 su_monkeysphere_user \
43 "gpg --keyserver $KEYSERVER --send-keys '0x${HOST_FINGERPRINT}!'"