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-2010, and are all released under the GPL,
14 # revoke service name user ID from host key
27 failure "You must specify a service name to revoke."
32 keyID=$(check_key_input "$@")
34 # make sure the user ID to revoke exists
35 check_key_userid "$keyID" "$serviceName" || \
36 failure "No non-revoked service name found matching '$serviceName'."
38 if [ "$PROMPT" != "false" ] ; then
39 printf "The following service name on key '$keyID' will be revoked:\n %s\nAre you sure you would like to revoke this service name? (Y/n) " "$serviceName" >&2
41 if [ "${OK/y/Y}" != 'Y' ] ; then
42 failure "User ID not revoked."
45 log debug "revoking service name without prompting."
50 # the gpg secring might not contain the host key we are trying to
51 # revoke (let alone any selfsig over that host key), but the plain
52 # --export won't contain the secret key. "keytrans revokeuserid"
53 # needs access to both pieces, so we feed it both of them.
55 if (cat "$GNUPGHOME_HOST/secring.gpg" && gpg_host --export "$keyID") \
56 | "$SYSSHAREDIR/keytrans" revokeuserid "$keyID" "$serviceName" \
57 | gpg_host --import ; then
59 gpg_host --check-trustdb
66 echo "NOTE: Service name revoked, but revocation not published."
67 echo "Run '$PGRM publish-key' to publish the revocation."
69 failure "Problem revoking service name."