summaryrefslogtreecommitdiff
path: root/share
diff options
context:
space:
mode:
Diffstat (limited to 'share')
-rwxr-xr-xshare/hydra/import-keys49
1 files changed, 32 insertions, 17 deletions
diff --git a/share/hydra/import-keys b/share/hydra/import-keys
index 8929baf..784deae 100755
--- a/share/hydra/import-keys
+++ b/share/hydra/import-keys
@@ -1,6 +1,6 @@
#!/bin/bash
#
-# Import a key into nodes.
+# Import keys into nodes.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
@@ -20,22 +20,8 @@
source $APP_BASE/lib/hydra/functions || exit 1
hydra_config_load
-# Command line arguments
-NODES="$*"
-
-# Build node list
-if [ -z "$NODES" ]; then
- NODES="`hydra $HYDRA nodes`"
-fi
-
-# Deploy
-for node in $NODES; do
- if [ ! -z "$HOST" ]; then
- hostname="$HOST"
- else
- hostname="`echo $node | cut -d . -f 1`"
- fi
-
+# Import OpenPGP keypair
+function hydra_import_keys_openpgp {
key="$(keyringer $HYDRA decrypt $hostname/gpg/key 2> /dev/null | sed -ne '1,$p')"
key_id="$(echo "$key" | gpg --with-colons | grep sec | cut -d : -f 5)"
@@ -64,4 +50,33 @@ for node in $NODES; do
sudo gpg --homedir /root/.gnupg --list-keys
##### END REMOTE SCRIPT #######
EOF
+}
+
+# Import OpenSSH keypair
+function hydra_import_keys_openssh {
+ # TODO
+ echo "Not implemented!"
+}
+
+# Command line arguments
+NODES="$*"
+
+# Build node list
+if [ -z "$NODES" ]; then
+ NODES="`hydra $HYDRA nodes`"
+fi
+
+# Deploy
+for node in $NODES; do
+ if [ ! -z "$HOST" ]; then
+ hostname="$HOST"
+ else
+ hostname="`echo $node | cut -d . -f 1`"
+ fi
+
+ # Import OpenPGP keypair
+ hydra_import_keys_openpgp
+
+ # Import OpenSSH keypair
+ hydra_import_keys_openssh
done