diff options
author | Raymaekers Luca <raymaekers.luca@gmail.com> | 2024-06-22 16:23:07 +0200 |
---|---|---|
committer | Raymaekers Luca <raymaekers.luca@gmail.com> | 2024-06-22 16:23:07 +0200 |
commit | d466dcc80e77463fa035fc85ced0c253e38cbac2 (patch) | |
tree | df8e20418fc6529e9639b0f38a205adfded16072 /bin/common/askpass | |
parent | 10e12bbe481af7974739060f51210f7948fc1df9 (diff) | |
parent | fcc378109f2c9d3f80a6213646d7c170dd93100d (diff) |
Merge branch 'main' of debuc.com:dotfiles
Diffstat (limited to 'bin/common/askpass')
-rwxr-xr-x | bin/common/askpass | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/bin/common/askpass b/bin/common/askpass new file mode 100755 index 0000000..c7d2249 --- /dev/null +++ b/bin/common/askpass @@ -0,0 +1,17 @@ +#!/bin/sh + +# 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 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 |