2 # This should be sourced by bash (though we welcome changes to make it POSIX sh compliant)
4 # Monkeysphere host revoke-hostname 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,
14 # revoke hostname user ID from host key
27 failure "You must specify a hostname to revoke."
30 echo "WARNING: There is a known bug in this function."
31 echo "This function has been known to occasionally revoke the wrong hostname."
32 echo "Please see the following bug report for more information:"
33 echo "https://labs.riseup.net/code/issues/show/422"
34 read -p "Are you sure you would like to proceed? (y/N) " OK; OK=${OK:=N}
35 if [ ${OK/y/Y} != 'Y' ] ; then
41 # make sure the user ID to revoke
42 uidIndex=$(find_host_userid) || \
43 failure "No non-revoked user ID found matching '$userID'."
45 if [ "$PROMPT" = "true" ] ; then
46 echo "The following host key user ID will be revoked:"
48 read -p "Are you sure you would like to revoke this user ID? (N/y) " OK; OK=${OK:=Y}
49 if [ "${OK/y/Y}" != 'Y' ] ; then
50 failure "User ID not revoked."
53 log debug "revoking user ID without prompting."
56 # edit-key script command to revoke user ID
57 revuidCommand=$(cat <<EOF
62 Hostname removed by monkeysphere-host: $DATE
69 # execute edit-key script
70 if echo "$revuidCommand" | gpg_host_edit ; then
77 echo "NOTE: User ID revoked, but revocation not published."
78 echo "Run '$PGRM publish-key' to publish the revocation."
80 failure "Problem revoking user ID."