From e55076d8e2c5f66a25c68c776889927e04774bcf Mon Sep 17 00:00:00 2001 From: Amolith Date: Thu, 10 Jul 2025 08:10:18 -0600 Subject: [PATCH] feat: add sshtmp --- dot_config/private_fish/functions/sshtmp.fish | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 dot_config/private_fish/functions/sshtmp.fish diff --git a/dot_config/private_fish/functions/sshtmp.fish b/dot_config/private_fish/functions/sshtmp.fish new file mode 100644 index 0000000000000000000000000000000000000000..2b820772d2c6e5cf8cc42531ae45d7da3a21aaa6 --- /dev/null +++ b/dot_config/private_fish/functions/sshtmp.fish @@ -0,0 +1,23 @@ +function sshtmp --description "Connect to an SSH host using a temporary, one-time key" + if test (count $argv) -eq 0 + echo "Usage: sshtmp [user@]hostname" + echo "Example: sshtmp sshtron.zachlatta.com" + return 1 + end + + set -l destination $argv[1] + + set -l tmp_dir (mktemp -d) + set -l key_path "$tmp_dir/id_ed25519" + + try + ssh-keygen -t ed25519 -f "$key_path" -N "" -C "sshtmp temporary key for $destination" >/dev/null + command ssh -i "$key_path" \ + -o IdentitiesOnly=yes \ + -o StrictHostKeyChecking=no \ + -o UserKnownHostsFile=/dev/null \ + $destination + finally + rm -rf "$tmp_dir" + end +end