Warp icon indicating copy to clipboard operation
Warp copied to clipboard

SSH fails for specific host

Open wuhhh opened this issue 2 years ago • 11 comments
trafficstars

Discord username (optional)

wuh#5913

Describe the bug

I have a bunch of SSH hosts set up in my ~/.ssh/config file and till now everything's worked fine using Warp to SSH in to each one. Hit a snag today on a WPEngine host though, here is the output:

bash: -c: line 0: syntax error near unexpected token `then'
bash: -c: line 0: `export TERM_PROGRAM=WarpTerminal _user=$(command -v whoami >/dev/null 2>&1 && command whoami 2>/dev/null || echo $USER) _hostname=$(command -v hostname >/dev/null 2>&1 && command hostname 2>/dev/null || uname -n) hook=$(printf {"hook": "SSH", "value": {"socket_path": "~/.ssh/167861612428743", "user": "%s", "host": "%s", "remote_shell": "%s"}} $_user $_hostname ${SHELL##*/} | command od -An -v -tx1 | command tr -d  \n) printf %                                         

Filing this as a Warp bug because I tried in iTerm2 and it works just fine.

To Reproduce

NA

Expected behaviour

NA

Screenshots

https://app.warp.dev/block/h9m1pXZDgQgonjjworqgfZ

Operating System

MacOS

OS Version

12.5.1

Shell Version

zsh 5.8.1 (x86_64-apple-darwin21.0)

Warp Version

0.2023.03.07.08.02.stable_01

Additional context

No response

Does this block you from using Warp daily?

No

Warp Internal (ignore): linear-label:b8107fdf-ba31-488d-b103-d271c89cac3e

None

wuhhh avatar Mar 12 '23 10:03 wuhhh

Thanks for letting us know @wuhhh. I'll bring this up with the team and we'll post any updates on this thread.

Please :+1: and comment if you're also seeing this issue as it helps us gauge impact.

dannyneira avatar Mar 13 '23 22:03 dannyneira

Can confirm I'm having the same issues as above and getting the same errors when trying to call any ssh command. Falling back to iTerm and SSH works as expected.

For now I've disabled the SSH wrapper as per comment on issue here https://github.com/warpdotdev/Warp/issues/2836#issuecomment-1487243462

ohararyan avatar Mar 24 '23 04:03 ohararyan

I think it would be great if we could disable the wrapper for certain hosts. I've got an older network switch (ICX6450) and the wrapper has never worked with that device from what I recall. I just get:

$ ssh admin@iceblock
Received disconnect from 10.10.20.2 port 22:2: Bad string Length

But for now I just do this to disable the wrapper for this one session:

WARP_USE_SSH_WRAPPER=0 && ssh admin@iceblock

But I rarely access this device, so I end up having to re-learn the env var every time I do need to get in there.

ammmze avatar May 16 '23 04:05 ammmze

Having the sam issue with WPEngine hosting. Having to rely on another terminal app to interact with it.

graham73may avatar Jul 18 '23 13:07 graham73may

@ammmze as an alternative workaround, you can prefix your ssh command with command e.g. command ssh <user@host> to circumvent the SSH wrapper

zachbai avatar Jul 19 '23 17:07 zachbai

Still happens, and only on WP Engine, works fine for Kinsta. Will there be some official solution for this?

dingo-d avatar Oct 27 '23 13:10 dingo-d

Same here, still happening for WP Engine...

mcDialogs avatar Jan 31 '24 17:01 mcDialogs

@zachbai's solution worked for me with WP Engine.

matthewfarlymn avatar Feb 29 '24 01:02 matthewfarlymn

Same here specifically for WPEngine

KrimoPixelsmith avatar Mar 12 '24 19:03 KrimoPixelsmith

(Copied here from other closed thread)

I just encountered this problem when using ssh to remotely execute a bash script on a wpengine site.

From testing the issue, it appears that wpengine is changing all whitespace characters in the ssh command string into spaces.

As a result wpengine bash is interpreting multi-line bash scripts as a single line, resulting in bash syntax errors.

mblais avatar Sep 14 '24 21:09 mblais

@ammmze as an alternative workaround, you can prefix your ssh command with command e.g. command ssh <user@host> to circumvent the SSH wrapper

Lifesaver, thank you!

andybz avatar Oct 16 '24 19:10 andybz

Hi, having the same issue here. Same as @ammmze, when I try to access my Brocade ICX6450 : Received disconnect from 192.168.10.254 port 22:2: Bad string Length

It's an old device, latest firmware, SSH can't be upgraded on it. I have to put that in my ~/.ssh/config file in the first place for it to work with SSH in macOS Terminal :

Host 192.168.10.254
    HostKeyAlgorithms +ssh-rsa
    PubkeyAcceptedAlgorithms=+ssh-rsa
    KexAlgorithms +diffie-hellman-group1-sha1

TheFou avatar Jan 19 '25 05:01 TheFou

Did some diggiing, and maybe found something, at least for my case :

Running a nmap --script ssh2-enum-algos -sV -p 22 192.168.10.254 outputs :

Nmap scan report for 192.168.10.254
Host is up (0.0026s latency).

PORT   STATE SERVICE VERSION
22/tcp open  ssh     AllegroSoft RomSShell sshd 5.40 (protocol 2.0)
| ssh2-enum-algos: 
|   kex_algorithms: (1)
|       diffie-hellman-group1-sha1
|   server_host_key_algorithms: (1)
|       ssh-rsa
|   encryption_algorithms: (7)
|       aes256-cbc
|       aes192-cbc
|       aes128-cbc
|       aes256-ctr
|       aes192-ctr
|       aes128-ctr
|       3des-cbc
|   mac_algorithms: (1)
|       hmac-sha1
|   compression_algorithms: (1)
|_      none

And when searching for this AllegroSoft RomSShell, I found this : https://www.chiark.greenend.org.uk/~sgtatham/putty/wishlist/ssh2-romsshell-badstringlen.html

Hope it helps.

TheFou avatar Jan 20 '25 01:01 TheFou

Got same problem when I use ssh to login in my Jump Server.

SSH command could work properly on iTerm2 and MacOS default terminal but lost connection on Warp. I checked ssh -vvv logs and finded out it is caused by SSH wrapper and when I close this feature, it works.

fortii2 avatar Apr 10 '25 02:04 fortii2