Community discussions

MikroTik App
 
theblop
just joined
Topic Author
Posts: 12
Joined: Thu Apr 23, 2009 12:45 am

Tunneling non-HTTP (e.g. SSH) over ROS web proxy

Thu Jan 14, 2010 8:39 pm

Hi,

Is it possible to use the routerOS proxy for tunneling non-http protocols like ssh?

Here is a simple example with apache and proxytunnel:
http://dag.wieers.com/howto/ssh-http-tunneling/

I've enabled the proxy in /ip proxy on port 8080 and created 2 access rules:
 0   src-address=0.0.0.0/0 dst-host=10.1.1.0/24 dst-port=22 method=CONNECT action=allow
 1   comment="default deny" src-address=0.0.0.0/0 action=deny
ROS is on 10.1.1.1 and my ssh server on 10.1.1.102.

To test the connection I did this (blue is what I typed, red is the proxy, green is the ssh server):

telnet 10.1.1.1 8080 # ROS ip
Trying 10.1.1.1...
Connected to 10.1.1.1.
Escape character is '^]'.

CONNECT 10.1.1.102:22 HTTP/1.0
(CR)

HTTP/1.0 200 OK

(CR)

SSH-2.0-OpenSSH_5.1p1 Debian-8
Protocol mismatch.
Connection closed by foreign host.


So far so good (the protocol mismatch is expected as I just sent a newline after the HTTP OK from the proxy)

Now when I use proxytunnel or putty with the http proxy option, the connection gets stuck after HTTP/1.0 OK from the proxy. With tcpdump on the server I can see that the text "SSH-2.0-OpenSSH_5.1p1 Debian-8" is sent back to the proxy but it never reaches the ssh client.

I suspect that the ROS proxy is line-oriented and waits for a Carriage Return before sending data...

Anyone managed to get the proxy to work with something else than http?

Thanks

PS: I don't want to use port forwarding.