LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
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 02-12-2009, 09:09 PM   #1
hazza96
Member
 
Registered: Apr 2001
Location: Brisbane, Australia
Distribution: Ubuntu
Posts: 146

Rep: Reputation: 15
IPTables redirection


Ok here is my situation:
  1. I work 2 weeks on 2 weeks off
  2. I have my own Linux server at home that I can access using ssh
  3. I pay for web site hosting on a shared host
  4. The web site allows configuration via the web browser
  5. It uses at https connection to port 8443
  6. My work location blocks just about every port, port 8443 is blocked.

What I would like to is use my home Linux server to bounce the traffic to the web site host. Port 80 is not being used for anything on my server and it is not blocked by work.

Would it be possible to create an iptables rule to redirect anything coming into port 80 from the external interface to my web host? Will the fact that it uses https make a difference?
 
Old 02-12-2009, 11:07 PM   #2
JulianTosh
Member
 
Registered: Sep 2007
Location: Las Vegas, NV
Distribution: Fedora / CentOS
Posts: 674
Blog Entries: 3

Rep: Reputation: 90
Bind your home SSH to port 80 on your home linux box.

Install squid proxy server on your home linux box and bind to localhost (127.0.0.1).

From work, SSH to your home box on port 80 and use port forwarding to access your squid proxy. (-L 8080:localhost:<squid listening port here>)

Set your browser proxy settings to (localhost:8080) that forwards to squid at home.
 
Old 02-12-2009, 11:20 PM   #3
hazza96
Member
 
Registered: Apr 2001
Location: Brisbane, Australia
Distribution: Ubuntu
Posts: 146

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by Admiral Beotch View Post
Bind your home SSH to port 80 on your home linux box.

Install squid proxy server on your home linux box and bind to localhost (127.0.0.1).

From work, SSH to your home box on port 80 and use port forwarding to access your squid proxy. (-L 8080:localhost:<squid listening port here>)

Set your browser proxy settings to (localhost:8080) that forwards to squid at home.
I have bound ssh to both port 80 and port 443.

Squid was already installed on the server at home.

SSH using what? The work PC is MS Windows and I use putty to ssh home. Can it be done using that?

I have Firefox portable installed on my external HDD. Can I configure it to only use the squid proxy at home for certain domains?
 
Old 02-12-2009, 11:33 PM   #4
JulianTosh
Member
 
Registered: Sep 2007
Location: Las Vegas, NV
Distribution: Fedora / CentOS
Posts: 674
Blog Entries: 3

Rep: Reputation: 90
yes, putty can do ssh port forwarding. It can be done either through plink or putty.

You'll have to get the ssh tunnel up before you try and use your firefox portable, but yes... configure the firefox portable proxy settings to the local side of the tunnel to get the traffic to your squid proxy at home.

You can configure firefox to only use the proxy settings for certain domains but once the request gets to the squid proxy, there isn't much choice but for it to handle the request.
 
Old 02-13-2009, 10:48 PM   #5
hazza96
Member
 
Registered: Apr 2001
Location: Brisbane, Australia
Distribution: Ubuntu
Posts: 146

Original Poster
Rep: Reputation: 15
Ha ha... it is even easier than I thought, here is how I did it:
  1. Started putty
  2. Loaded the 'home' session
  3. Went to 'Connections -> SSH -> Tunnels'
  4. Entered '8443' in the source port
  5. Entered 'mydomain:8443' as the destination
  6. Saved the putty session
  7. Connected the ssh session
  8. Entered 'https://localhost:8443' in Firefox

Any connection to port 8443 on the local host is tunneled by putty to my home server, this then connects to my web host on port 8443.

I could have used any port number in step 4 but decided to keep it easy to remember. The other good thing is that I do not need to change my proxy settings in Firefox.

Now I just need to figure out how to use this so I can use Pidgin to connect to all the IM networks....

Last edited by hazza96; 02-13-2009 at 10:50 PM.
 
Old 02-13-2009, 11:00 PM   #6
JulianTosh
Member
 
Registered: Sep 2007
Location: Las Vegas, NV
Distribution: Fedora / CentOS
Posts: 674
Blog Entries: 3

Rep: Reputation: 90
same thing... create (another ??) tunnel to your proxy server and in pidgin, set the (http) proxy settings for the account - or you can change the global network settings to use the http proxy and all accounts will use that.
 
Old 02-13-2009, 11:36 PM   #7
hazza96
Member
 
Registered: Apr 2001
Location: Brisbane, Australia
Distribution: Ubuntu
Posts: 146

Original Poster
Rep: Reputation: 15
Hmmmm I tried that, in Putty I have port 8080 tunneled to localhost:3128. I have Pidgin using HTTP proxy 'localhost:8080' but I am getting en error message:

Quote:
Access denied HTTP Proxy server forbids port 5190 tunneling
My squid server has the following in it's conf file:
Quote:
http_port 3128 transparent
....
acl Safe_ports port 5190 # Pidgin
acl Safe_ports port 5222 # Pidgin
acl Safe_ports port 5050 # Pidgin
....
http_access deny !Safe_ports
 
Old 02-16-2009, 01:16 AM   #8
hazza96
Member
 
Registered: Apr 2001
Location: Brisbane, Australia
Distribution: Ubuntu
Posts: 146

Original Poster
Rep: Reputation: 15
I have searched for the answer to this but can't find what is wrong or what I need to do so that squid will allow the port tunneling.
 
Old 02-16-2009, 01:57 AM   #9
hazza96
Member
 
Registered: Apr 2001
Location: Brisbane, Australia
Distribution: Ubuntu
Posts: 146

Original Poster
Rep: Reputation: 15
I got it working, I found this web page that gave me the answer to what I needed to change in squid.

I wanted to connect to all the IM networks so I added the needed sections to the conf file. All I had to do was add lines similar to these:
Quote:
acl aim port 5190-5200
no_cache allow aim
http_access allow aim
 
  


Reply

Tags
iptables



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
iptables redirection? prayag_pjs Linux - Newbie 3 04-16-2008 11:10 PM
iptables redirection mallikk_in Linux - Networking 11 09-02-2007 01:00 AM
Help:iptables redirection swmok Linux - Networking 2 11-24-2004 07:47 AM
IPtables Redirection Exception? BoarderX Linux - Networking 7 09-22-2004 06:43 PM
redirection of ftp using iptables bacon22 Linux - General 1 03-10-2004 05:21 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 12:55 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
Open Source Consulting | Domain Registration