summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2010-11-23 19:32:28 -0200
committerSilvio Rhatto <rhatto@riseup.net>2010-11-23 19:32:28 -0200
commit47576624e86ebf94b8c9558876274cf97029701d (patch)
tree95029ea39025bba297871e31b4f6ea9e63c8440c
parentc0f48eadd0dbfad507add60ded114ae647263dac (diff)
downloadhydra-47576624e86ebf94b8c9558876274cf97029701d.tar.gz
hydra-47576624e86ebf94b8c9558876274cf97029701d.tar.bz2
Getting the key ID at import-key
-rwxr-xr-xshare/hydra/import-key12
1 files changed, 9 insertions, 3 deletions
diff --git a/share/hydra/import-key b/share/hydra/import-key
index a6204f2..c1b141c 100755
--- a/share/hydra/import-key
+++ b/share/hydra/import-key
@@ -22,19 +22,25 @@ fi
# Deploy
for node in $NODES; do
+ hostname="`echo $node | cut -d . -f 1`"
+ key_id="`keyringer $HYDRA decrypt $hostname/gpg/key 2> /dev/null | gpg --with-colons | grep sec | cut -d : -f 5`"
+
+ if [ -z "$key_id" ]; then
+ echo "Could not find key for $node, skipping."
+ continue
+ fi
+
echo ""
echo "-----------------------------"
echo "Importing gpg key to $node..."
echo "-----------------------------"
echo ""
- hostname="`echo $node | cut -d . -f 1`"
keyringer $HYDRA decrypt $hostname/gpg/key | $HYDRA_CONNECT $node sudo gpg --homedir /root/.gnupg --import
- # TODO: get the full keyid
echo ""
echo "Trusting key at $node..."
echo ""
- printf "trust\n5\ny\nsave\n" | $HYDRA_CONNECT $node sudo gpg --homedir /root/.gnupg --no-tty --status-fd=2 --command-fd=0 --edit-key root@$node
+ printf "trust\n5\ny\nsave\n" | $HYDRA_CONNECT $node sudo gpg --homedir /root/.gnupg --no-tty --status-fd=2 --command-fd=0 --edit-key $key_id
echo ""
echo "Verifying..."