When using cygwin + ssh, the http_proxy setting doesn't work

1

2

I have a issue where, under cygwin, the http_proxy env variable is being ignored. i've tried upper case and lower case for the variable name, it's just not being read by ssh.

export HTTP_PROXY="http://user:pass@proxy.job.com:8080/"

Doesn't use proxy

ssh myuser@home.com

Uses proxy

wget http://home.com/

Does anyone see what i'm doign wrong?

Roy Rico

Posted 2010-07-12T23:28:50.593

Reputation: 4 808

Answers

9

Your question is not clear because you don't explain what you're trying to achieve. I'm going to venture a guess, which could of course be wrong. My guess is that:

  • you want to use ssh to connect from your work machine to home.com;
  • ssh home.com doesn't work (hangs, or displays an error message) because your work firewall is blocking outgoing connections;
  • user:pass@proxy.job.com:8080 is the proxy you've configured in your web browser at work.

Since ssh uses the ssh protocol, and not the http or https protocol, it doesn't care about the http_proxy or https_proxy variable.

There is a way to tunnel ssh traffic through an https proxy. The proxy can't distinguish ssh traffic from https traffic since they're both encrypted. Three programs that can do this are netcat (the OpenBSD version), corkscrew and connect-proxy. I'm going to give an example for corkscrew which I know is provided in Cygwin. Use the following settings in your .ssh/config file:

Host home
HostName home.com
User myuser
ProxyCommand /usr/bin/corkscrew proxy.job.com 8080 %h %p /path/to/corkscrew/authfile

and put a single line containing user:pass in /path/to/corkscrew/authfile.

Some proxies won't allow you to connect to port 22 (the normal ssh port), only to port 443 (the normal https port). If you have control over the server at home.com, you can get it to listen on port 443 as well: most likely you'll either want to add 443 to the Port line in the sshd_config file, or to redirect incoming connections on port 443 on your home router to port 22 on your sshd machine. Then add Port 443 below the HostName line in .ssh/config.

Alternatively, if your firewall-piercing efforts fail, look into installing Ajaxterm on a web server outside the firewall.

Gilles 'SO- stop being evil'

Posted 2010-07-12T23:28:50.593

Reputation: 58 319