From: Nicolas Boisselier Date: Thu, 7 Mar 2019 23:27:16 +0000 (+0000) Subject: etc/profile.d/gpg.sh X-Git-Url: https://git.nbdom.net/?a=commitdiff_plain;h=f9d5a8ce0f50b9c9d887bd218c21797d2dbe92b0;p=nb.git etc/profile.d/gpg.sh --- 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 ~/ +}