git.lirion.de

Of git, get, and gud

aboutsummaryrefslogtreecommitdiffstats
path: root/bin/ssh-with-gpg
blob: 7ca0d67c36f4b2687e1771d9b8997974e876cfba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/usr/bin/env bash

# For this to work, you also need to import the public key of any private key you want to use
# in the target server's pubring first.

if [ -z "$1" ];then
	printf "USAGE: %b TARGET [OPTIONS...]\\n" "$(basename "$0")" >&2
	exit 1
fi

TGT="$1"

REMUID="$(ssh "$TGT" "id -u")"
ssh "$TGT" 'killall gpg-agent 2>/dev/null;rm -f /run/user/$(id -u)/gnupg/S.*'
if [ -z "$REMUID" ];then
	printf "Cannot fetch user id from %b.\\n" "$TGT" >&2
	exit 2
fi

ssh -R "/run/user/${REMUID}/gnupg/S.gpg-agent":"/run/user/$(id -u)/gnupg/S.gpg-agent-extra" -o "StreamLocalBindUnlink=yes" "$TGT" "${@:2}"
>/+5 * NEW FEATURE: prompt may be quite long, we now start input on a completely new...H. P. 2024-05-251-2/+2 * Distinguish between Leap and others (Tumbleweed), current colouring from offi...v1.0.0H. P. 2024-05-251-2/+12 * return if reading the fingerprint failedH. P. 2024-05-251-1/+1 * MergeH. P. 2024-05-252-8/+53 |\ | * fix: root colouring for Debian < 12v0.9.5H. P. 2023-05-061-1/+1 | * New colours for Debian > 12 and derivativesH. P. 2023-05-061-4/+38 | * Superseding flake8-colors - considering that deprecatedH. P. 2023-05-061-1/+3 | * + termuxH. P. 2023-04-081-0/+10 | * fix: non-SLE suse did not apply anywhereH. P. 2023-04-081-2/+2 * | local fixesH. P. 2024-05-255-10/+16 |/ * +pvev0.9.4H. P. 2022-07-261-1/+5 * Revert "+deprecation of ssh-rsa altogether"H. P. 2022-07-171-4/+0 * +deprecation of ssh-rsa altogetherH. P. 2022-07-171-0/+4 * +par ssh key generationH. P. 2022-07-171-0/+3 * +example paragraph for ssh-rsa connectionsH. P. 2022-07-171-0/+10 * .gitconfig for @8eadf0c5ed061ceee22e4b1a75eaa55eeb72e02aH. P. 2022-07-171-1/+1 * ...in case of confname=hostname*conf...H. P. 2022-07-161-0/+0 * ( ͡° ͜ʖ ͡°)H. P. 2022-07-161-1/+1 * +ssh control masterH. P. 2022-07-164-0/+20 * don't be vrebose on adding ssh keysv0.9.3H. P. 2022-07-081-1/+1 * i said "no background" !!!11!elevenH. P. 2022-07-061-0/+2 * Execute key addition on any login on the hosts which serve as "admin stations"H. P. 2022-07-061-1/+5 * Only add SSH key if it's not been added yet.H. P. 2022-07-061-1/+4 * display current IFSH. P. 2022-07-061-0/+1 * Do not execute any remote action on localhostH. P. 2022-07-051-24/+25 * Do not execute remote removal on localhostH. P. 2022-07-051-0/+8