fixing ssh agent

This commit is contained in:
2021-09-03 12:14:38 -04:00
parent 606a490fe7
commit 15c3246618
5 changed files with 55 additions and 15 deletions

17
.bashrc
View File

@@ -128,22 +128,9 @@ alias config='/usr/bin/git --git-dir=/home/sstent/.cfg/ --work-tree=/home/sstent
# Configure ssh forwarding
export SSH_AUTH_SOCK=$HOME/.ssh/agent.sock
# need `ps -ww` to get non-truncated command for matching
# use square brackets to generate a regex match for the process we want but that doesn't match the grep command running it!
ALREADY_RUNNING=$(ps -auxww | grep -q "[n]piperelay.exe -ei -s //./pipe/openssh-ssh-agent"; echo $?)
if [[ $ALREADY_RUNNING != "0" ]]; then
if [[ -S $SSH_AUTH_SOCK ]]; then
# not expecting the socket to exist as the forwarding command isn't running (http://www.tldp.org/LDP/abs/html/fto.html)
echo "removing previous socket..."
rm $SSH_AUTH_SOCK
fi
echo "Starting SSH-Agent relay..."
# setsid to force new session to keep running
# set socat to listen on $SSH_AUTH_SOCK and forward to npiperelay which then forwards to openssh-ssh-agent on windows
(setsid socat UNIX-LISTEN:$SSH_AUTH_SOCK,fork EXEC:"npiperelay.exe -ei -s //./pipe/openssh-ssh-agent",nofork &) > /dev/null 2>&1
. ~/bin/wsl-ssh-agent-forwarder
fi
dockerbuild() {
docker build -t registry.service.dc1.consul:5000/${1} ~/ansible-home/compose/${1}/
docker push registry.service.dc1.consul:5000/${1}