Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I'm browsing the web on a client PC running Windows or Linux. I want to browse a website (http://access.lan:52050//cgi-bin/login.cgi) which is not directly accessible from my PC.

  • I can browse the website if I go through a proxy machine. Its IP address is 192.168.1.1. It's running Red Hat Linux.
  • I can log in to the Red Hat machine from my client PC with SSH version 1.

How can I set this up in a simple way?

share|improve this question
    
I think that I understand your question, but it was very difficult. Please check that my rewording has kept the meaning you intended. Please, make an effort to write understandable English, even if English is not your native language (it isn't mine either). –  Gilles Jan 11 '12 at 1:39
    
yes, re-wording is fine - sorry –  Tony Jan 11 '12 at 2:20
add comment

2 Answers

You can use ssh tunneling to access the website. Since the PC with ip 192.168.1.1 has the access to the website, you can make 192.168.1.1 to ask the website on your behalf. All the requests sent by you will first be sent to the 192.168.1.1 in a ssh tunnel.

You have to use the following command:

$ ssh -N -L your-port:access.lan:52050 user-name@192.168.1.1

Note:

1. your-port: Port > 1024 which you will make as your end of tunnel.    
2. user-name: login name of the user on 192.168.1.1 whose passwd you know.
share|improve this answer
add comment

From a Linux client (212.1.1.1), run this command in a terminal:

ssh -L 3130:localhost:3128 192.168.1.1

This redirects connections to TCP port 3130 on the Linux client to TCP port 3128 on 192.168.1.1. You can pick whichever port you like instead of 3130 on the local machine. On the proxy, use whatever port the proxy program is running on (it could be 3128, or 8080, or another port altogether).

When you want to use the proxy, tell your browser to use localhost port 3130 as the proxy (http://127.0.0.1:3030/).

If you don't want to have to edit your browser settings every time you start and stop using the proxy, use a browser extension such as Foxy Proxy for Firefox or a Chrome equivalent and set it up to use http://127.0.0.1:3030/ as a proxy only for URLS matching http://access.lan:52050/*.

If you're going to do this often, add the following lines to the file ~/.ssh/config:

Host some_proxy
HostName 192.168.1.1
LocalForward 3130 localhost:3128

Then run ssh some_proxy (you can choose a more significant name than some_proxy).

Note: SSH version 1 is antique. I think the commands I mentioned existed back then, but I didn't check. I'm surprised that an SSH version 1 server is still running. Are you sure you can't use SSH protocol version 2?

share|improve this answer
    
the proxy is using only version 1 (out of my control) Red Hat Linux 9 (Shrike) did exactly as above and page cannot be displayed on firefox - checked that loopback address 127.0.0.1 and port 3130 were selected under tools>options>network>settings>manual proxy config also ran ssh -L 3130:localhost:3128 192.168.1.1 on 212.1.1.1 ok so 212.1.1.1 is listening in on 3130 for tcp connections before making the forwarding decision to > 3128 192.168.1.1 my question is how does firefox know about 192.168.1.1 via the 127.0.0.1 loopback address that you have asked me to enter into firefox ? –  Tony Jan 11 '12 at 5:48
    
I used to use this script many moons ago but does not work anymore, if it helps ssh -1 -f -l username -o "ForwardX11 yes" -o "StrictHostKeyChecking no" -L 6003:212.1.1.1:2222 192.168.1.1 sleep 5 >/dev/null 2>&1 xterm -title HTTPSESSION -e ssh -1 -q -o "StrictHostKeyChecking no" -l username -p 6003 -L 8080:access.lan:8080 localhost & –  Tony Jan 11 '12 at 6:00
    
@Tony Firefox knows nothing about 192.168.1.1, it contacts localhost:3130. SSH is listening on localhost:3130 and forwards the request to the remote proxy. Is the proxy still running on 192.168.1.1? (Try a text mode web browser such as w3m or lynx.) What happens if you run http_proxy=http://127.0.0.1:3030/ wget http://www.google.com/? What is the error in Firefox? –  Gilles Jan 11 '12 at 9:08
    
my concern is looking at my previous script is that it looks for 192.168.1.1 proxy address where as your advice does not mention this, therefore how does my client listen to ssh port 3130 (apart from me putting this into firefox as a manual proxy 127.0.0.1 3130 surely this is simply a logical tcp/http port that my browser will try to connect to)? you asked that my listening command is placed onto the 212.1.1.1 system? - remember my client knows not of this, only 192.168.1.1 proxy –  Tony Jan 11 '12 at 18:10
    
@Tony Your previous script was similar to what I posted, with different port numbers. Check that you used the correct port numbers. I can't help you more without knowing what happens when you try your old setup (what errors do you see?). –  Gilles Jan 11 '12 at 18:15
show 5 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.