From 3145010306902a8b9e0a5863527837aa963afef5 Mon Sep 17 00:00:00 2001 From: Raymaekers Luca Date: Fri, 21 Jun 2024 22:37:33 +0200 Subject: checkpoint --- bin/common/askpass | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100755 bin/common/askpass (limited to 'bin/common') 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 -- cgit v1.2.3