You are not logged in.

#1 2013-03-15 03:56:44

o1911
Member
From: Hobart, Australia
Registered: 2009-04-28
Posts: 106

Reverse ssh tunnelling with mosh?

Hi,

Perhaps I'm being cheeky, but I'd like to know if this is possible, avoiding autossh.  The idea is to connect to a machine at home with my laptop at uni (heavily firewalled) with mosh, passing in a reverse tunnel command. Because mosh likes to be alive whenever possible, so long as my laptop has internet access, the reverse tunnel is open.

The command I've used is:

mosh -p 60000 --ssh="ssh -4 -p27182 -R 19999:localhost:22" serenity@xxx.xxx.xxx.xxx

Upon connecting, and testing the reverse tunnel:

serenity@xxx$ ssh -p19999 yyy@localhost
socket: Address family not supported by protocol
ssh: connect to host localhost port 19999: Address family not supported by protocol

After a google, this error message seems to be attributed to ssh using IPv6 when it shouldn't, but using -4 in the ssh command above does not resolve the issue.  Any ideas?


Arch x86_64

Offline

#2 2013-03-15 11:45:41

falconindy
Developer
From: New York, USA
Registered: 2009-10-22
Posts: 4,111
Website

Re: Reverse ssh tunnelling with mosh?

I suspect this probably has something to do with mosh using UDP and ssh using TCP.

Offline

#3 2013-03-15 12:37:48

hunterthomson
Member
Registered: 2008-06-22
Posts: 794
Website

Re: Reverse ssh tunnelling with mosh?

falconindy wrote:

I suspect this probably has something to do with mosh using UDP and ssh using TCP.

Ya, could be. I don't know what mosh is 'really' doing with that command.

I thought it was tunneling the ssh connection through the mosh connection. TCP over UDP is exactly what you would want to do, but maybe that is not is what is happening.


OpenBSD-current Thinkpad X230, i7-3520M, 16GB CL9 Kingston, Samsung 830 256GB
Contributor: linux-grsec

Offline

#4 2013-03-15 14:23:23

p0x8
Member
Registered: 2012-09-20
Posts: 70

Re: Reverse ssh tunnelling with mosh?

Mosh does not keep the ssh session alive. It only uses it to login into the remote machine and start the mosh server there.

The message you are getting is odd, though. Your connection should just be refused. Have you checked if there's actually a process listening on the 19999 port:

$ netstat -putan | grep LISTEN | grep 19999

Or tried to connect to some other random port to see if you get the same error:

$ ssh -p51289 yyy@localhost

Offline

#5 2013-03-15 23:04:38

o1911
Member
From: Hobart, Australia
Registered: 2009-04-28
Posts: 106

Re: Reverse ssh tunnelling with mosh?

p0x8 wrote:
$ netstat -putan | grep LISTEN | grep 19999

There is no output, so I'm assuming that you're right in that ssh is not kept alive.  Also, if I try my above mosh command and attempt to reverse tunnel with the IPv4 'standard' localhost address:

serenity@xxx$ ssh -p19999 yyy@127.0.0.1
ssh: connect to host 127.0.0.1 port 19999: Connection refused

... which is interesting, but probably only a side-effect of ssh rather than what I want to work.  Alas, thanks for your help!


Arch x86_64

Offline

#6 2013-03-16 02:22:08

progandy
Member
Registered: 2012-05-17
Posts: 5,184

Re: Reverse ssh tunnelling with mosh?

You should try the patch for UDP hole punching:
https://github.com/brettviren/mosh/blob … _punch.org

Last edited by progandy (2013-03-16 02:24:50)


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |

Online

Board footer

Powered by FluxBB