git.lirion.de

Of git, get, and gud

aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Pfeiffer <coding _ lirion.de> 2022-03-23 13:27:06 +0100
committerHarald Pfeiffer <coding _ lirion.de> 2022-03-23 13:27:06 +0100
commit947ad9638a1607e751eddfaab37d5eed369326eb (patch)
treeb7662f1326d468be044a1366a33addb06049226d
parent38a9b146f6268e38a09e3498020665a3b60d0663 (diff)
downloaddotfiles-947ad9638a1607e751eddfaab37d5eed369326eb.tar.bz2
untested behaviour: ssh-with-gpg
-rwxr-xr-xbin/ssh-with-gpg20
1 files changed, 20 insertions, 0 deletions
diff --git a/bin/ssh-with-gpg b/bin/ssh-with-gpg
new file mode 100755
index 0000000..bd5a61f
--- /dev/null
+++ b/bin/ssh-with-gpg
@@ -0,0 +1,20 @@
+#!/usr/bin/env bash
+
+# THIS IS A DRAFT FOR TESTING. IF YOU WANT TO USE THIS, REMOVE OR COMMENT THE
+# FOLLOWING LINE:
+exit 0
+
+if [ -z "$1" ];then
+ printf "USAGE: %b TARGET [OPTIONS...]\\n" "$(basename "$0")" >&2
+ exit 1
+fi
+
+TGT="$1"
+
+REMUID="$(ssh "$TGT" "id -u")"
+if [ -z "$REMUID" ];then
+ printf "Cannot fetch user id from %b.\\n" "$TGT" >&2
+ exit 2
+fi
+
+ssh -R "/run/user/$(id -u)/gnupg/S.dirmngr":"/run/user/${REMUID}/gnupg/S.dirmngr" -o "StreamLocalBindUnlink=yes"