From f9d5a8ce0f50b9c9d887bd218c21797d2dbe92b0 Mon Sep 17 00:00:00 2001 From: Nicolas Boisselier Date: Thu, 7 Mar 2019 23:27:16 +0000 Subject: [PATCH] etc/profile.d/gpg.sh --- etc/profile.d/gpg.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/etc/profile.d/gpg.sh b/etc/profile.d/gpg.sh index 495b648e..51be8815 100644 --- a/etc/profile.d/gpg.sh +++ b/etc/profile.d/gpg.sh @@ -1,2 +1,9 @@ which gpg >/dev/null 2>&1 || return export GPG_TTY=$(tty) +gpg_import_host() { + local usage="gpg_import_host HOST" + local host=${1:?$usage} + local tmp="/tmp/gpg_import_host.$USER" + ssh -t "$host" 'GPG_TTY=$(tty) gpg --armor --export-secret-keys -o "'$tmp'"' + ssh "$host" 'cat "'$tmp'" && rm "'$tmp'"' | gpg --import --allow-secret-key-import ~/ +} -- 2.47.3