diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2015-09-11 11:07:56 -0300 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2015-09-11 11:07:56 -0300 |
commit | c3ddbeb7b3cde2174169cb29f25e6f1a1d978395 (patch) | |
tree | 1853daa92280624b1af6d773750d955f1f2bdacf /share | |
parent | 4a7f22c535dffb792fff4b46b7df5fee62ddde3d (diff) | |
download | hydra-c3ddbeb7b3cde2174169cb29f25e6f1a1d978395.tar.gz hydra-c3ddbeb7b3cde2174169cb29f25e6f1a1d978395.tar.bz2 |
Enhances import-keys
Diffstat (limited to 'share')
-rwxr-xr-x | share/hydra/import-keys | 49 |
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 |