LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices



Reply
 
Search this Thread
Old 08-16-2008, 01:13 PM   #1
rhololkeolke
LQ Newbie
 
Registered: Aug 2008
Posts: 1

Rep: Reputation: 0
Can SSH into server but have trouble using tunnels as proxy


I'm trying to set up my remote ssh server so that I can tunnel web traffic through it while I'm on an unsecured network. I set up the ssh server and can successfully ssh into from a different network. However, when I try to set up a tunnel so that I can use it as a proxy it doesn't work. I was using the command
Code:
ssh -p 222 -D 9999 user@sshserver
I set up firefox to use the socks proxy localhost on port 9999 but when I try to go to a website I just get a blank white page and nothing loads. I would think that if it wasn't working I would get an error but instead I just get a blank white page. I'd like to know what I'm doing wrong and how to fix it. Also I'd like to know if the command I was using to establish an ssh tunnel is the best way to do it. Thanks in advance.
 
Old 08-16-2008, 01:32 PM   #2
jiml8
Senior Member
 
Registered: Sep 2003
Posts: 3,171

Rep: Reputation: 115Reputation: 115
You need to have an http proxy running on the ssh server if you expect to tunnel web traffic through it.

Also you need to set up your tunnel correctly.

Let us assume that you have your proxy on your ssh server watching port 8118. In this case, you would define a port on your client machine (the one you want to browse from) that you will point your browser toward. Let us say that this port is 8008.

Your tunnel statement would look like this:

ssh -f -L 8008:localhost:8118 sshserveripaddress -N -l user@sshserver

You then would point your browser at port 8008 and it will work.

I do this fairly frequently when I am out and about with my laptop; I ssh back into my workstation in order to have secure connections from my laptop (in a coffee shop or airport that might matter). I normally run privoxy on my workstation anyway, so I just proxy through it.
 
Old 08-19-2008, 04:58 AM   #3
blackhole54
Senior Member
 
Registered: Mar 2006
Posts: 1,896

Rep: Reputation: 61
@jiml8,

What you say is correct, but the OP is wanting to use the remote sshd as a socks proxy rather than tunneling to a listening application/server.

@rhololkeolke,

Your command looks correct to me. (As an aside, you might wish to try the -f option like jiml8 showed, but that is not your real problem.) I believe it is the sshd on the other end that actually acts as the proxy. So it must be capable of doing this. (I believe SSH daemons that are at all recent should have this capability, but maybe there is a compile time option?) I couldn't find any config file options for this. So the only thing I know to do is use a packet sniffer (tcpdump, wireshark, etc.) to monitor packets. Check the lo interface(on tcp/9999) on the originating machine and the Internet facing interface on the remote machine to see what packets are being sent and received. And you can use netstat to make sure that ssh actually is listening on tcp/9999 on your local machine.

NOTE: I've use the-D option for socks proxy on my LAN but I have never used it to actually go out to the Internet. So there may be some subtlety I am missing. Hmmm. Such as DNS? But I have read of people doing what you are trying.

Last edited by blackhole54; 08-19-2008 at 05:01 AM.
 
  


Reply

Tags
proxy, socks, ssh, tunneling


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I prevent SSH tunnels through my squid proxy? drokmed Linux - Security 11 06-12-2008 09:07 PM
a bit lost with ssh tunnels and proxy yanik Linux - Networking 2 05-31-2006 04:11 PM
Server Defined SSH Tunnels dlublink Linux - Software 1 09-29-2005 09:11 PM
SSH tunnels and VNC, yet again. Edaph Linux - Security 7 05-23-2004 10:55 AM
Automatic SSH Tunnels fearofcarpet Linux - Software 1 12-05-2003 12:36 AM


All times are GMT -5. The time now is 05:22 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration