summaryrefslogtreecommitdiff
path: root/bin/common/askpass
diff options
context:
space:
mode:
authorRaymaekers Luca <raymaekers.luca@gmail.com>2024-06-22 13:49:00 +0200
committerRaymaekers Luca <raymaekers.luca@gmail.com>2024-06-22 13:49:00 +0200
commit30f72f36d20e9757eddcd71301403920779f31d6 (patch)
tree24179cac49835de6570ea7ec38fb6a9076b4f39e /bin/common/askpass
parent32256e087aaf7744348a5ba33e802d5c8d9d97dd (diff)
checkpoint
Diffstat (limited to 'bin/common/askpass')
-rwxr-xr-xbin/common/askpass8
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