summaryrefslogtreecommitdiff
path: root/bin/common
diff options
context:
space:
mode:
authorRaymaekers Luca <raymaekers.luca@gmail.com>2024-06-21 22:37:33 +0200
committerRaymaekers Luca <raymaekers.luca@gmail.com>2024-06-21 22:37:33 +0200
commit3145010306902a8b9e0a5863527837aa963afef5 (patch)
treea6d6750fa17c2964cd241afa8e963cac6106b390 /bin/common
parentc9cc72113521b793d1baa0d2f558b97478a6acf4 (diff)
checkpoint
Diffstat (limited to 'bin/common')
-rwxr-xr-xbin/common/askpass13
1 files changed, 13 insertions, 0 deletions
diff --git a/bin/common/askpass b/bin/common/askpass
new file mode 100755
index 0000000..2725dbf
--- /dev/null
+++ b/bin/common/askpass
@@ -0,0 +1,13 @@
+#!/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 and use the final name of the key
+# find the according password.
+key="$(printf '%s\n' "$1" |
+ cut -f 2 -d \' |
+ awk -F '/' '{print $NF}')"
+pass="keys/$(hostname)/ssh/$key"
+
+pass show "$pass" | head -n 1