assh icon indicating copy to clipboard operation
assh copied to clipboard

Investigate what can be done with/by/using/for mosh

Open moul opened this issue 9 years ago • 1 comments

Thanks to @rothgar' comment, I'm opening this issue to track ideas and experiements around mosh.

Mosh is an amazing tool and adding the power of mosh in assh would be awesome.

I did some tests, but I wasn't able to find a cool way of integrating mosh with assh.


Technical note:

assh is a ProxyCommand, so basically it acts as a pipe between the ssh binary and the (remote) ssh server daemon (99% of the time, it is just a smart netcat).

mosh uses ssh to connect to the remote host to initiate a session with the mosh-server that will allow mosh-client to communicate with the mosh-server using UDP.

For now, I wasn't able to find a way to use mosh from withing assh as mosh was requiring ssh itself for the first authentication (sorry for the complicated phrase :smile:).


Edit 1:: here is a proof-of-concept that works :)

$ mosh myserver nc localhost 22
SSH-2.0-OpenSSH_6.9p1 Ubuntu-2ubuntu0.1

I'm successfuly opening a valid ProxyCommand over a mosh session

moul avatar Mar 14 '16 15:03 moul

I use assh, which adds ProxyCommand to every connection, and I got it fully working with the following steps:

  • Create /usr/local/bin/mosh_fallback
#!/usr/bin/env bash
mosh --experimental-remote-ip=remote "$@"

status=$?

if [ $status -eq 5 ] || [ $status -eq 127 ] || [ $status -eq 10 ]; then
        ssh "$@"
fi
  • Just alias ssh with alias ssh "/usr/local/bin/mosh_fallback"

After that, it worked flawlessly on all my use cases, automatically falling back to ssh when mosh isn't installed on the remote.

kamushadenes avatar Oct 12 '18 03:10 kamushadenes