commit: cbbc886eadec7f993bbf75abbf96cc171443be5d
parent d33babe82d2eb824ee0fb02013c81bf1c09e3990
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date: Thu, 19 Nov 2020 15:24:03 +0100
Hook ssh-add(1) to pass(1) via SSH_ASK_PASS
Diffstat:
3 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/.common.sh b/.common.sh
@@ -71,6 +71,9 @@ esac
# = helpers =
ssh_add_all() {
+ # Make ssh-add call ${SSH_ASK_PASS} even outside of X11
+ export DISPLAY="${DISPLAY:-dummy}"
+
ssh-add $(find ~/.ssh -name 'id_*' -a \( \! -name '*.pub' \))
}
diff --git a/.local/bin/ssh-ask-pass.sh b/.local/bin/ssh-ask-pass.sh
@@ -0,0 +1,3 @@
+#!/bin/sh
+entry="$(echo "$@" | sed -e 's;^Enter passphrase for '"$HOME/.ssh"';SSH;' -e 's;: $;;')"
+pass show "${entry}" | head -1
diff --git a/.profile b/.profile
@@ -31,6 +31,7 @@ export PS4='[32m$ [0m'
export QEMU_AUDIO_DRV=alsa
export SSH_AGENT_PID=$(cat ${HOME}/.ssh/agent.pid)
export SSH_AUTH_SOCK="${HOME}/.ssh/agent.sock"
+export SSH_ASK_PASS="${HOME}/.local/bin/ssh-ask-pass.sh"
export TERMINAL='st'
export TZ='Europe/Paris'
export QT_STYLE_OVERRIDE=adwaita-dark