0

I know this is not a new question, but I have researched a bit and so far none of the answers I've seen gave me the answer.

I have this situation:

I´m working on a campus where the network is highly insecure (certain people are doing packet sniffing) and proxy servers are used for internet access. I have access to a server (communication between this and the proxy does not have this problem) having mounted an sshd. Although I can not log in directly, I can use it for ssh tunnel (in fact the tunnel is already being used with Windows machines with personal configurations).

I need to make downloads with wget using one of the proxies that are configured to access. I created the following configuration using my client ssh

export sshuname=MySshUsername
export sshupass=MySshPassword
export sshrserver=MyRemoteSSHD
export proxyserver=MyProxyServer
nohup sshpass -p $sshupass ssh $sshuname@$sshrserver -N -C -L 8082:$proxyserver:3128 &

When I try to telnet proxy server responds me correctly

telnet localhost 8082

But when I use the same with wget

export http_proxy=http://localhost:8082
export https_proxy=http://localhost:8082
export ftp_proxy=http://localhost:8082

export proxy_user=MyProxyUserName
export proxy_passwd=MyProxyPassword

export dir_pref=TEST
export log_name=test
export url=http://internet.site/path/file.tgz
wget -c -t0 --no-check-certificate --proxy-user=$proxy_user --proxy-password=$proxy_passwd --directory-prefix=$dir_pref $url

wget reports the following error

Resolving localhost (localhost)... 127.0.0.1, ::1 Connecting to localhost (localhost)|127.0.0.1|:8082... failed: Connection refused. Connecting to localhost (localhost)|::1|:8082... failed: Address family not supported by protocol.

Can anyone tell me I'm doing wrong?

Make proxy with SOCKS is not an option !!!

The local iptables on this machine is accepting connections on port 8082.

In the future, the next step would be to make for each of the Proxies connections that pass through this machine to be redirected through ssh tunnel in the way I described above. This machine is the firewall for internal network of my department and "theoretically" my internal network has no problems.

  • I think that the authentication step should be handled by the INITIAL connection by using an URI that provides such information like: -N -C -L 8082:user:password@proxy:3128 &. – user34720 May 3 '16 at 13:31
  • What does 'netstat -na --tcp' tell you after the tunnel has been opened? – gerhard d. May 3 '16 at 13:47
  • gerhard d. The netstat returns me the following > tcp 0 0 127.0.0.1:8082 0.0.0.0:* LISTEN When I do a test port with the command telnet localhost 8082 The poxy server answer me on the other side with the classic message of protest that I am not sending authenticated requests, the tunnel works, my problem is put to work my wget with that tunnel – Joel Inglao May 9 '16 at 13:21
  • nwildner. I do not think the authentication step should be handled that way, ssh is done with a different machine that supports the proxy machine and what I'm doing with it is a local port redirection. Anyway I do not see how I can put it that way authentication in the process of redirection connection. – Joel Inglao May 9 '16 at 14:16

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.