From: Nicolas Boisselier Date: Thu, 7 Mar 2019 23:50:46 +0000 (+0000) Subject: etc/profile.d/gpg.sh X-Git-Url: https://git.nbdom.net/?a=commitdiff_plain;h=0d562c1e2a67205b0e31fd4f589a01cc2c40878e;p=nb.git etc/profile.d/gpg.sh --- diff --git a/etc/profile.d/gpg.sh b/etc/profile.d/gpg.sh index 51be8815..6568f841 100644 --- a/etc/profile.d/gpg.sh +++ b/etc/profile.d/gpg.sh @@ -1,9 +1,9 @@ which gpg >/dev/null 2>&1 || return export GPG_TTY=$(tty) -gpg_import_host() { +gpg_import_ssh() { 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 ~/ + ssh -t "$host" 'install -m 600 /dev/null "'$tmp'" && GPG_TTY=$(tty) gpg --armor --export-secret-keys -o "'$tmp'"' + ssh "$host" 'cat "'$tmp'" && rm "'$tmp'"' | gpg --import --allow-secret-key-import }