department-of-veterans-affairs/vtk

vtk socks setup fails on macOS with fish shell

Opened this issue · 0 comments

I was experiencing an error when running the setup script: fish: No such file or directory
I found this issue in the fish-shell repo that matched what I was experiencing: set -gx SHELL fish causes ssh to fail on mac when tunneling through a bastion server
It helped me reach a quick workaround: env SHELL=$(which fish) vtk socks setup

Perhaps the docs or code could be changed to help anyone else running into this.

Repro

oren.mittman@orenmittman-DHQ3972P5G ~/s/w/vtk (master) [1]> vtk socks setup
remote: Enumerating objects: 1, done.
remote: Counting objects: 100% (1/1), done.
remote: Total 1 (delta 0), reused 0 (delta 0), pack-reused 0
Receiving objects: 100% (1/1), 879 bytes | 879.00 KiB/s, done.
----> Testing SOCKS SSH connection... ❌ ERROR: SSH Connection to SOCKS server unsuccessful. Error message:
ssh -i /Users/oren.mittman/.ssh/id_rsa_vagov -F /Users/oren.mittman/.ssh/config -o ConnectTimeout=5 -vvv socks -D 2001 -N
OpenSSH_9.0p1, LibreSSL 3.3.6
debug1: Reading configuration data /Users/oren.mittman/.ssh/config
debug1: /Users/oren.mittman/.ssh/config line 23: Applying options for socks
debug1: /Users/oren.mittman/.ssh/config line 166: Applying options for *
debug2: add_identity_file: ignoring duplicate key ~/.ssh/id_rsa_vagov
debug2: resolve_canonicalize: hostname 172.31.2.171 is address
debug3: expanded UserKnownHostsFile '~/.ssh/known_hosts' -> '/Users/oren.mittman/.ssh/known_hosts'
debug3: expanded UserKnownHostsFile '~/.ssh/known_hosts2' -> '/Users/oren.mittman/.ssh/known_hosts2'
debug1: Authenticator provider $SSH_SK_PROVIDER did not resolve; disabling
debug1: Executing proxy command: exec ssh -l dsva -A 52.222.32.121 -i ~/.ssh/id_rsa_vagov -W 172.31.2.171:22
debug3: timeout: 5000 ms remain after connect
debug1: identity file /Users/oren.mittman/.ssh/id_rsa_vagov type 0
debug1: identity file /Users/oren.mittman/.ssh/id_rsa_vagov-cert type -1
fish: No such file or directory
debug1: identity file /Users/oren.mittman/.ssh/id_rsa_vagov type 0
debug1: identity file /Users/oren.mittman/.ssh/id_rsa_vagov-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_9.0
kex_exchange_identification: Connection closed by remote host
Connection closed by UNKNOWN port 65535

Workaround

oren.mittman@orenmittman-DHQ3972P5G ~/s/w/vtk (master) [1]> env SHELL=$(which fish) vtk socks setup
remote: Enumerating objects: 1, done.
remote: Counting objects: 100% (1/1), done.
remote: Total 1 (delta 0), reused 0 (delta 0), pack-reused 0
Receiving objects: 100% (1/1), 879 bytes | 879.00 KiB/s, done.
----> Testing SOCKS SSH connection... ✅ DONE
----> Configuring SOCKS tunnel to run on system boot... ✅ DONE
----> SOCKS setup complete. 

The following change to the code worked on my system as well:

def ssh_output
  `env SHELL=$(which $SHELL) ssh -i #{ssh_key_path} -F #{ssh_config_path} -o ConnectTimeout=5 -q socks -D #{port} exit 2>&1`
end