diff options
author | Raymaekers Luca <raymaekers.luca@gmail.com> | 2024-07-01 01:14:59 +0200 |
---|---|---|
committer | Raymaekers Luca <raymaekers.luca@gmail.com> | 2024-07-01 01:14:59 +0200 |
commit | e1de506156454ba1d324faf548ad15fe804aa806 (patch) | |
tree | 1ca249b22bace59d41e950b7482443440ccc8c5e /bin/common/askpass | |
parent | fecb6306631aaec1774497093b7da44ab5950d92 (diff) | |
parent | b2077bbddf86dbdbf6cc63aaf2ceb8a2da614ebc (diff) |
Merge branch 'main' of db:dotfiles
Diffstat (limited to 'bin/common/askpass')
-rwxr-xr-x | bin/common/askpass | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/bin/common/askpass b/bin/common/askpass index 2725dbf..c7d2249 100755 --- a/bin/common/askpass +++ b/bin/common/askpass @@ -3,11 +3,15 @@ # We can figure out the password for the key based on $1 # which is in the following form: # Enter passphrase for key 'path/to/key': -# The point is to retrieve the path and use the final name of the key -# find the according password. +# The point is to retrieve the path where the filename is the name of +# the key. +# Then we can construct the path for pass and get the password. key="$(printf '%s\n' "$1" | cut -f 2 -d \' | awk -F '/' '{print $NF}')" pass="keys/$(hostname)/ssh/$key" +# optional: add key to running ssh-agent +keyadd "$key" & + pass show "$pass" | head -n 1 |