1

I have a windows machine with putty, which has access to ms sql server on local network. And i have a remote Ubuntu machine on the Internet with sshd on 443 port (required to establish secured connection over https proxy). I want to forward some ms sql ip:port on local network to remote ubuntu machine. You can see my forwarding settings below:

tunnel settings

And it works like expected when i start this ssh session without proxy (I can easily check this with telnet localhost 31339):

root@ubuntu:~# telnet localhost 31339
Trying ::1...
Connected to localhost.localdomain.
Escape character is '^]'.

But when i use http proxy with HTTP CONNECT method support, this port is not forwarded. Whenn i try to check forwarding with telnet localhost 31339, i instantly get Connection closed by foreign host.:

root@ubuntu:~# telnet localhost 31339
Trying ::1...
Connected to localhost.localdomain.
Escape character is '^]'.
Connection closed by foreign host.

At the same time i tried to sniff packets on my windows machine with Wireshark and saw no packets related to this port forwarding rule at all. Putty does not even try to establish TCP connection to ms sql server on local network.

As i said the only difference between working and not working port forwarding rule is using http proxy, which should decrease the max size of ip packet in theory and this is probably the problem... So i tend to think there can be some sshd settings which can handle this situatuion.

I also did another test: I tried to forward local VNC port 5900 from my windows machine to local ubuntu port the same ways i do with ms sql port. And this works (does not matter if i use proxy to establish ssh connection or no):

root@vm5594:~# telnet localhost 31337
Trying ::1...
Connected to localhost.localdomain.
Escape character is '^]'. RFB 003.008

That is wthy i really wonder what can be the problem and ask you ti help. Any suggestions?

TL;DR When i use https proxy for ssh connection ms sql port forwarding does not work, but works without proxy. VNC port forwarding works without problems in both situations.

Please feel free to ask anything you did not understand. Maybe my question is not detailed enough.

  • You probably want a NAT rule or redir. an http proxy talks, well http, you have to take the underlying connection out of http to send it to another destination. – Rui F Ribeiro Dec 3 '15 at 17:23
  • Can I ask why you're running ssh over an https proxy? I know it's off topic but it seems like an unnecessary addition that would have a tendency to break things (just like it's doing) – David King Dec 7 '15 at 20:33
  • @DavidKing i can use it without proxy, but i am curious why it breaks ms sql port forwarding while it does not break VNC. I really need an exmplanation. – Derp Dec 8 '15 at 10:28
  • 1
    This looks like a bug in putty's redirection code. It might for example get tempted to send the redirected, local TCP connection through the same HTTP(S) proxy that is used to connect to the SSH server. And then if there are access rules on the redirected server, or the proxy server, this may stop the traffic. – Laszlo Valko Dec 11 '15 at 16:54
  • @LaszloValko ye, looks like a bug. Today i used a combination of ssh and connect-proxy from Cygwin and everything works like expected – Derp Dec 14 '15 at 12:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.