LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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
 
LinkBack Search this Thread
Old 11-18-2009, 12:11 PM   #1
ge2000
LQ Newbie
 
Registered: Aug 2009
Location: 52N - 5.5E
Distribution: CentOS & Ubuntu
Posts: 11

Rep: Reputation: 0
Squid question about port redirect


Hi all,

Not sure if this is possible with squid but here's the question.

My squid is listening to port 80. Due to certain network restrictions only traffic to destinations on port 80 is allowed. Now we have behind squid a webserver running on port 88.

Is it possible, and how to 'translate' request for webserver:80 to webserver:88 with squid?

thanks,
Ge
 
Old 11-18-2009, 12:25 PM   #2
EricTRA
Guru
 
Registered: May 2009
Location: Barcelona, Spain
Distribution: LMDE Gnome with Awesome WM + Kernel 3.3.0-1 amd64
Posts: 6,518
Blog Entries: 1

Rep: Reputation: 1217Reputation: 1217Reputation: 1217Reputation: 1217Reputation: 1217Reputation: 1217Reputation: 1217Reputation: 1217Reputation: 1217
I may be mistaking but I don't think Squid is your problem since you can perfectly tell Squid to send to the 'cache_peer' on port 88. If your webserver is listening on port 88 and your network policy prohibits that, then how can you get traffic through? By making an exclusion in your policy? By adapting your firewall configuration? If its prohibited on network traffic level, then how does anyone connect to that webserver?

Kind regards,

Eric
 
Old 11-18-2009, 12:32 PM   #3
ge2000
LQ Newbie
 
Registered: Aug 2009
Location: 52N - 5.5E
Distribution: CentOS & Ubuntu
Posts: 11

Original Poster
Rep: Reputation: 0
ok, maybe I was not clear. Traffic between squid and the webserver is possible. The only problem is that clients will always connect to webserver:80

So cache_peer should do the trick. I thought this option was to chain to another proxy. I will give it a try then.

Ge
 
Old 11-18-2009, 12:36 PM   #4
EricTRA
Guru
 
Registered: May 2009
Location: Barcelona, Spain
Distribution: LMDE Gnome with Awesome WM + Kernel 3.3.0-1 amd64
Posts: 6,518
Blog Entries: 1

Rep: Reputation: 1217Reputation: 1217Reputation: 1217Reputation: 1217Reputation: 1217Reputation: 1217Reputation: 1217Reputation: 1217Reputation: 1217
Structure like this should work:
Code:
cache_peer 000.000.000.000 parent 80 0 no-query originserver name=a_name_you_give
acl site_a_name_you_give dstdomain a_name_you_give.domain.com
cache_peer_access a_name_you_give allow site_a_name_you_give
Kind regards,

Eric
 
Old 11-18-2009, 01:07 PM   #5
ge2000
LQ Newbie
 
Registered: Aug 2009
Location: 52N - 5.5E
Distribution: CentOS & Ubuntu
Posts: 11

Original Poster
Rep: Reputation: 0
Thanks for taking the time to help me!

In your example config I still don't see how squid is connecting to the destination webserver port 88.

The required path should be:

client request=http://webserver:80 forwarded to proxy=squid:80
squid should connect to destination=webserver:88


thanks,
Ge
 
Old 11-18-2009, 01:23 PM   #6
EricTRA
Guru
 
Registered: May 2009
Location: Barcelona, Spain
Distribution: LMDE Gnome with Awesome WM + Kernel 3.3.0-1 amd64
Posts: 6,518
Blog Entries: 1

Rep: Reputation: 1217Reputation: 1217Reputation: 1217Reputation: 1217Reputation: 1217Reputation: 1217Reputation: 1217Reputation: 1217Reputation: 1217
Sorry, I didn't change the parent port in the example I posted since I figured you know Squid. Ok, let's break it apart a little bit for clarification.

Before the cache_peer you define Squid listening port like:
Code:
http_port xxx.xxx.xxx.xxx:80 defaultsite=www.tradisa.com vhost
where xxx is the IP you want Squid to listen on. Furthermore you're telling it with vhost that it's a virtual host for other servers.

Then the cache_peer:
Code:
cache_peer 000.000.000.000 parent 88 0 no-query originserver name=a_name_you_give
acl site_a_name_you_give dstdomain a_name_you_give.domain.com
cache_peer_access a_name_you_give allow site_a_name_you_give
here you state that one of the servers to which the vhost can connect is 000.000.000.000 (IP address of the real webserver). The 'parent 80' tells Squid to connect on port 80 and originserver tells it that it's a destination server not something like a proxy.

With the name= statement you give it a name so you can refer to it in the acl and cache_peer_access statement.

Like I put it here, in the acl you give the site a name to (to refer in the access statement) like site_nameyougive.

dstdomain means that only those who request that particular domain name get connected to that particular webserver. If for example you type in a browser http://mything.domain.com then Squid will not connect you. On the other hand if you type in http://a_name_you_give.domain.com then you will get connected to the correct webserver on port 88.

Then the last line determines the access you give to the site and server. If you want everyone to be able to access it, then you just delete or comment it out and down the line where you configure your http_access rules you just put:
Code:
http_access allow all
That's the way I configured it to have 8 different webservers available and three of them do not connect on a standard port.

Kind regards,

Eric
 
Old 11-18-2009, 01:59 PM   #7
ge2000
LQ Newbie
 
Registered: Aug 2009
Location: 52N - 5.5E
Distribution: CentOS & Ubuntu
Posts: 11

Original Poster
Rep: Reputation: 0
Thanks Eric.

This was very helpfull information. A quick test seems to work fine.

Kind regards,
Ge
 
Old 11-18-2009, 02:01 PM   #8
EricTRA
Guru
 
Registered: May 2009
Location: Barcelona, Spain
Distribution: LMDE Gnome with Awesome WM + Kernel 3.3.0-1 amd64
Posts: 6,518
Blog Entries: 1

Rep: Reputation: 1217Reputation: 1217Reputation: 1217Reputation: 1217Reputation: 1217Reputation: 1217Reputation: 1217Reputation: 1217Reputation: 1217
You're welcome Ge, glad it works

Kind regards,

Eric

BTW: am I correct to state that you are in the Netherlands? Judging from your Location?
 
Old 11-18-2009, 03:36 PM   #9
ge2000
LQ Newbie
 
Registered: Aug 2009
Location: 52N - 5.5E
Distribution: CentOS & Ubuntu
Posts: 11

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by EricTRA View Post
BTW: am I correct to state that you are in the Netherlands? Judging from your Location?
Yes, you are correct.
 
Old 11-18-2009, 03:40 PM   #10
EricTRA
Guru
 
Registered: May 2009
Location: Barcelona, Spain
Distribution: LMDE Gnome with Awesome WM + Kernel 3.3.0-1 amd64
Posts: 6,518
Blog Entries: 1

Rep: Reputation: 1217Reputation: 1217Reputation: 1217Reputation: 1217Reputation: 1217Reputation: 1217Reputation: 1217Reputation: 1217Reputation: 1217
I'm from Belgium Aangename kennismaking.

Geboorteplaats: Turnhout, vlak tegen de nederlandse grens.

Kind regards/Met vriendelijke groet,

Eric
 
Old 11-19-2009, 08:35 AM   #11
ge2000
LQ Newbie
 
Registered: Aug 2009
Location: 52N - 5.5E
Distribution: CentOS & Ubuntu
Posts: 11

Original Poster
Rep: Reputation: 0
Hi Eric,

Well, your current location seems to be much warmer :-)


The squid-proxy is working fine only for sites without authentication. We have a few IIS servers (sorry, we do sometimes use ms) which require authentication. In the past we never had problems with this but now with the accel option things are working different. Well, I'm even more a newbie on squid than I thought :-)

Nogmaals bedankt voor je antwoorden.

groeten,
Ge
 
Old 11-19-2009, 08:44 AM   #12
EricTRA
Guru
 
Registered: May 2009
Location: Barcelona, Spain
Distribution: LMDE Gnome with Awesome WM + Kernel 3.3.0-1 amd64
Posts: 6,518
Blog Entries: 1

Rep: Reputation: 1217Reputation: 1217Reputation: 1217Reputation: 1217Reputation: 1217Reputation: 1217Reputation: 1217Reputation: 1217Reputation: 1217
Oh, believe me it is a lot warmer here then Belgium, and more important a lot dryer

All our servers require authentication, but none are IIS, I got spared of that disaster The sites we run that are still on Windows (for the time being) are all running Tomcat.

Graag gedaan.

Kind regards,

Eric
 
Old 11-19-2009, 09:12 AM   #13
ge2000
LQ Newbie
 
Registered: Aug 2009
Location: 52N - 5.5E
Distribution: CentOS & Ubuntu
Posts: 11

Original Poster
Rep: Reputation: 0
Quote:
Oh, believe me it is a lot warmer here then Belgium, and more important a lot dryer
Please don't poke me in the eyes!




Found it! I appended login=PASS to the cache_peer line and now this works fine as well.


groeten,
Ge
 
Old 11-19-2009, 09:15 AM   #14
EricTRA
Guru
 
Registered: May 2009
Location: Barcelona, Spain
Distribution: LMDE Gnome with Awesome WM + Kernel 3.3.0-1 amd64
Posts: 6,518
Blog Entries: 1

Rep: Reputation: 1217Reputation: 1217Reputation: 1217Reputation: 1217Reputation: 1217Reputation: 1217Reputation: 1217Reputation: 1217Reputation: 1217
Fantastic, well done.

Kind regards,

Eric
 
  


Reply


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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Squid NTLM and Redirect help InEeDhElPlInUx Linux - Server 0 11-01-2007 07:44 PM
debian iptables squid - redirect port 80 to port 8080 on another machine nickleus Linux - Networking 1 08-17-2006 12:59 AM
Squid redirect butchybro Linux - Networking 0 06-04-2005 05:06 AM
Outside FTP Port 21 redirect to different port inside LAN??? hendrixx Linux - Security 5 06-05-2004 06:42 PM
Redirect ICQ to Squid Padre Linux - Software 0 12-18-2003 07:29 AM


All times are GMT -5. The time now is 08:06 PM.

Main Menu
 
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
Open Source Consulting | Domain Registration