mirror of
https://github.com/sstent/dotfiles.git
synced 2026-01-26 17:12:18 +00:00
fixing ssh agent
This commit is contained in:
BIN
bin/npiperelay.exe
Executable file
BIN
bin/npiperelay.exe
Executable file
Binary file not shown.
25
bin/sshnodes.sh.save
Executable file
25
bin/sshnodes.sh.save
Executable file
@@ -0,0 +1,25 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Set Session Name
|
||||
SESSION="sshnodes"
|
||||
SESSIONEXISTS=$(tmux list-sessions | grep $SESSION)
|
||||
|
||||
# Only create tmux session if it doesn't already exist
|
||||
if [ "$SESSIONEXISTS" = "" ]
|
||||
then
|
||||
# Start New Session with our name
|
||||
tmux new-session -d -s $SESSION
|
||||
tmux rename-window -t sshnodes
|
||||
tmux split-window -v
|
||||
tmux split-window -h
|
||||
tmux selectp -t 0
|
||||
tmux split-window -h
|
||||
tmux send-keys -t 0 "autossh odroid1" C-m
|
||||
tmux send-keys -t 1 "autossh odroid2" C-m
|
||||
tmux send-keys -t 2 "autossh odroid3" C-m
|
||||
tmux customize-mode
|
||||
fi
|
||||
|
||||
# Attach Session, on the Main window
|
||||
tmux attach-session -t $SESSION:0
|
||||
|
||||
28
bin/wsl-ssh-agent-forwarder
Executable file
28
bin/wsl-ssh-agent-forwarder
Executable file
@@ -0,0 +1,28 @@
|
||||
#!/bin/bash
|
||||
# Usage: wsl-ssh-agent-forward [ -k | -r ]
|
||||
# Options:
|
||||
# -k Kill the current process (if exists) and do not restart it.
|
||||
# -r Kill the current process (if exists) and restart it.
|
||||
# Default operation is to start a process only if it does not exist.
|
||||
|
||||
export SSH_AUTH_SOCK=$HOME/.ssh/agent.sock
|
||||
|
||||
sshpid=$(ss -ap | grep "$SSH_AUTH_SOCK")
|
||||
if [ "$1" = "-k" ] || [ "$1" = "-r" ]; then
|
||||
sshpid=${sshpid//*pid=/}
|
||||
sshpid=${sshpid%%,*}
|
||||
if [ -n "${sshpid}" ]; then
|
||||
kill "${sshpid}"
|
||||
else
|
||||
echo "'socat' not found or PID not found"
|
||||
fi
|
||||
if [ "$1" = "-k" ]; then
|
||||
exit
|
||||
fi
|
||||
unset sshpid
|
||||
fi
|
||||
|
||||
if [ -z "${sshpid}" ]; then
|
||||
rm -f $SSH_AUTH_SOCK
|
||||
( setsid socat UNIX-LISTEN:$SSH_AUTH_SOCK,fork EXEC:"$HOME/bin/npiperelay.exe -ei -s //./pipe/openssh-ssh-agent",nofork & ) >/dev/null 2>&1
|
||||
fi
|
||||
Reference in New Issue
Block a user