I would like to build an ssh tunnel from my android device (call it A) on port MMM to a machine C on port NNN. HOWEVER, A and C are not directly connected. They are only connected through machine B (which is also running an ssh server). Finally, port NNN is only open locally on machine C (which is also running an ssh server).
So, with openssh in unix, I can use the command line of ssh or the ProxyCommand argument in .ssh/config to archive this:
Host C-tunnel
HostName C
Port 22
Use username
IdentityFile ~/.ssh/myidentityfileforC.pem
ProxyCommand ssh -e none -i /.ssh/myidentityfileforB.pem username@B nc -w 120 %h %p 2> /dev/null
I can then set up a tunnel straight from my localhost to C:NNN (through the connection above).
Is there an app for android that supports similar? I tried connectbot and ssh autotunnel. The later got close, as I could set up one tunnel from A to B and then another from A to C (through the tunnelled A->B connection), but initiating the latter brought both of them down. Setting up just the first tunnel and then using connectbot allows me to connect via ssh to C, but I cannot set up a port forward directly to C:NNN.
Any suggestions? Is there a direct port of openssh I've missed?