From 5eab477a9755178abf56eeba5f658db882611eec Mon Sep 17 00:00:00 2001 From: Jameson Graef Rollins Date: Tue, 17 Feb 2009 02:23:17 -0500 Subject: [PATCH] rename create_gpg_pub_file to be update_gpg_pub_file, and add it to every function that alters the host keyring, so that all changes will show up in exported pub key file, and in show-key. --- src/monkeysphere-host | 10 +++++----- src/share/mh/add_hostname | 2 ++ src/share/mh/add_revoker | 2 ++ src/share/mh/import_key | 2 +- src/share/mh/revoke_hostname | 2 ++ src/share/mh/set_expire | 2 ++ 6 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/monkeysphere-host b/src/monkeysphere-host index 9d3ccb1..a7b9697 100755 --- a/src/monkeysphere-host +++ b/src/monkeysphere-host @@ -97,11 +97,10 @@ gpg_host_edit() { } # export the host public key to the monkeysphere gpg pub key file -create_gpg_pub_file() { - log debug "creating openpgp public key file..." +update_gpg_pub_file() { + log debug "updating openpgp public key file '$HOST_KEY_FILE'..." gpg_host --export --armor --export-options export-minimal \ "0x${HOST_FINGERPRINT}!" > "$HOST_KEY_FILE" - log info "GPG host public key file: $HOST_KEY_FILE" } # load the host fingerprint into the fingerprint variable, using the @@ -140,7 +139,8 @@ check_host_key() { # fail if host key not present check_host_no_key() { [ -s "$HOST_KEY_FILE" ] \ - || failure "You don't appear to have a Monkeysphere host key on this server. Please run 'monkeysphere-host import-key' first." + || failure "You don't appear to have a Monkeysphere host key on this server. +Please run 'monkeysphere-host import-key' first." } # output the index of a user ID on the host key @@ -184,7 +184,7 @@ show_key() { # list the host key info # FIXME: make no-show-keyring work so we don't have to do the grep'ing - # FIXME: why is this not showing key expiration? + # FIXME: can we show uid validity somehow? gpg --list-keys --fingerprint \ --list-options show-unusable-uids 2>/dev/null \ | grep -v "^${GNUPGHOME}/pubring.gpg$" \ diff --git a/src/share/mh/add_hostname b/src/share/mh/add_hostname index 46326bb..910faf6 100644 --- a/src/share/mh/add_hostname +++ b/src/share/mh/add_hostname @@ -51,6 +51,8 @@ EOF # execute edit-key script if echo "$adduidCommand" | gpg_host_edit ; then + update_gpg_pub_file + show_key echo diff --git a/src/share/mh/add_revoker b/src/share/mh/add_revoker index b6affbb..1464ae8 100644 --- a/src/share/mh/add_revoker +++ b/src/share/mh/add_revoker @@ -97,6 +97,8 @@ failure "not implemented yet!" if echo "$addrevokerCommand" | \ gpg_core_edit ; then + update_gpg_pub_file + log info "Revoker added." else failure "Problem adding revoker." diff --git a/src/share/mh/import_key b/src/share/mh/import_key index ed6ee4f..6f12b7f 100644 --- a/src/share/mh/import_key +++ b/src/share/mh/import_key @@ -61,7 +61,7 @@ printf "%s:6:\n" "$HOST_FINGERPRINT" | gpg_host --import-ownertrust gpg_host --check-trustdb # export to gpg public key to file -create_gpg_pub_file +update_gpg_pub_file # show info about new key show_key diff --git a/src/share/mh/revoke_hostname b/src/share/mh/revoke_hostname index 3addf90..99ba603 100644 --- a/src/share/mh/revoke_hostname +++ b/src/share/mh/revoke_hostname @@ -65,6 +65,8 @@ EOF # execute edit-key script if echo "$revuidCommand" | gpg_host_edit ; then + update_gpg_pub_file + show_key echo diff --git a/src/share/mh/set_expire b/src/share/mh/set_expire index b03e0d0..0b581d9 100644 --- a/src/share/mh/set_expire +++ b/src/share/mh/set_expire @@ -29,6 +29,8 @@ $extendTo save EOF +update_gpg_pub_file + cat <