aboutsummaryrefslogtreecommitdiff
path: root/share
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2018-05-17 19:11:21 -0300
committerSilvio Rhatto <rhatto@riseup.net>2018-05-17 19:11:21 -0300
commit213b4bae731d0893b6fb5fa3ded8f58ec7149639 (patch)
tree7870a1450aa1586130a5a66e037f26026084b408 /share
parentaa0e58fb719abf9081179ef122f93a3a11356067 (diff)
downloadhydra-213b4bae731d0893b6fb5fa3ded8f58ec7149639.tar.gz
hydra-213b4bae731d0893b6fb5fa3ded8f58ec7149639.tar.bz2
Use passphrase at import-keys
Diffstat (limited to 'share')
-rwxr-xr-xshare/hydra/import-keys5
1 files changed, 3 insertions, 2 deletions
diff --git a/share/hydra/import-keys b/share/hydra/import-keys
index fe026b6..b5953cb 100755
--- a/share/hydra/import-keys
+++ b/share/hydra/import-keys
@@ -24,6 +24,7 @@ hydra_config_load
function hydra_import_keys_openpgp {
key="$(keyringer $HYDRA decrypt nodes/$hostname/gpg/key 2> /dev/null | sed -ne '1,$p')"
pubkey="$(keyringer $HYDRA decrypt nodes/$hostname/gpg/key.pub 2> /dev/null | sed -ne '1,$p')"
+ passphrase="$(keyringer $HYDRA decrypt nodes/$hostname/gpg/key.passwd 2> /dev/null)"
key_id="$(echo "$pubkey" | gpg --with-colons | grep pub | cut -d : -f 5)"
if [ -z "$key" ]; then
@@ -39,7 +40,7 @@ function hydra_import_keys_openpgp {
echo "Importing gpg key to $node..."
echo "-----------------------------"
echo ""
- echo "$key" | sudo gpg --homedir /root/.gnupg --import
+ echo -e "${passphrase}\n${key}" | sudo gpg --passphrase-fd 0 --no-tty --homedir /root/.gnupg --import
echo ""
echo "Trusting key $key_id at $node..."
@@ -58,7 +59,7 @@ EOF
echo "Importing gpg key to $node..."
echo "-----------------------------"
echo ""
- echo "$key" | sudo gpg --homedir /root/.gnupg --import
+ echo -e "${passphrase}\n${key}" | sudo gpg --passphrase-fd 0 --no-tty --homedir /root/.gnupg --import
echo ""
echo "Trusting key $key_id at $node..."