got rid of monkeysphere-host fprs file
[monkeysphere.git] / src / monkeysphere-host
index eadd74bcedb1e4d1abdd896c199b7ebf4b18e63a..ef4107a30f6475f81319c8f20b6e30ffec45e051 100755 (executable)
@@ -35,8 +35,6 @@ MHDATADIR="${SYSDATADIR}/host"
 
 # host pub key files
 HOST_KEY_FILE="${SYSDATADIR}/host_keys.pub.gpg"
-# host pub key fingerprints file
-HOST_KEY_FPR_FILE="${SYSDATADIR}/host_keys.fprs"
 
 # UTC date in ISO 8601 format if needed
 DATE=$(date -u '+%FT%T')
@@ -94,14 +92,13 @@ gpg_host_edit() {
 # export the monkeysphere gpg pub key file
 update_gpg_pub_file() {
     log debug "updating openpgp public key file '$HOST_KEY_FILE'..."
-    gpg_host --export --armor --export-options export-minimal > "$HOST_KEY_FILE"
-    log debug "updating fingerprint file '$HOST_KEY_FPR_FILE'..."
-    gpg_host --list-secret-key --with-colons --with-fingerprint \
-       | awk -F: '/^fpr:/{ print $10 }' > "$HOST_KEY_FPR_FILE"
+    gpg_host --export --armor --export-options export-minimal \
+        $(gpg_host --list-secret-keys --with-colons --fingerprint | grep ^fpr | cut -f9 -d:) \
+        > "$HOST_KEY_FILE"
 }
 
 host_fingerprints() {
-    local fprs=($(cat "$HOST_KEY_FPR_FILE"))
+    local fprs=($(<"$HOST_KEY_FILE" "$SYSSHAREDIR/keytrans" listfprs))
 
     log debug "host key fingerprints:"
     printf '%s\n' "${fprs[@]}" | log debug
@@ -116,7 +113,7 @@ check_service_name() {
 
 # fail if host key not present
 check_no_keys() {
-    [ -s "$HOST_KEY_FILE" ] || [ -s "$HOST_KEY_FPR_FILE" ] \
+    [ -s "$HOST_KEY_FILE" ] \
        || failure "You don't appear to have a Monkeysphere host key on this server.
 Please run 'monkeysphere-host import-key' import a key."
 }