TransparentProxy(1).pdf
(
41 KB
)
Pobierz
Transparent Proxy with Linux and Squid mini-HOWTO
Transparent Proxy with Linux and Squid mini−HOWTO
Transparent Proxy with Linux and Squid mini−HOWTO
Table of Contents
Transparent Proxy with Linux and Squid mini−HOWTO..
...........................................................................1
Daniel Kiracofe.
.......................................................................................................................................1
1. Introduction.
.........................................................................................................................................1
2. Overview of Transparent Proxying.
.....................................................................................................1
3. Configuring the Kernel.
.......................................................................................................................1
4. Setting up squid.
..................................................................................................................................1
5. Setting up iptables (Netfilter.
..............................................................................................................1
6. Transparent Proxy to a Remote Box.
...................................................................................................1
7. Transparent Proxy With Bridging.
.......................................................................................................1
8. Put it all together.
.................................................................................................................................1
9. Troubleshooting.
..................................................................................................................................1
10. Further Resources.
.............................................................................................................................2
1. Introduction.
.........................................................................................................................................2
1.1 Comments.
.........................................................................................................................................2
1.2 Copyrights and Trademarks.
..............................................................................................................2
1.3 #include <disclaimer.h>..
...................................................................................................................2
2. Overview of Transparent Proxying.
.....................................................................................................2
2.1 Motivation.
.........................................................................................................................................2
2.2 Scope of this document.
.....................................................................................................................3
2.3 HTTPS.
..............................................................................................................................................4
2.4 Proxy Authentication.
........................................................................................................................4
3. Configuring the Kernel.
.......................................................................................................................4
4. Setting up squid.
..................................................................................................................................5
5. Setting up iptables (Netfilter.
..............................................................................................................6
6. Transparent Proxy to a Remote Box.
..................................................................................................6
6.1 First method (simpler, but does not work for some esoteric cases).
..................................................6
6.2 Second method (more complicated, but more general).
....................................................................7
6.3 Method One: What if iptables−box is on a dynamic IP?.
..................................................................8
7. Transparent Proxy With Bridging.
.......................................................................................................8
8. Put it all together.
.................................................................................................................................8
9. Troubleshooting.
..................................................................................................................................9
10. Further Resources.
.............................................................................................................................9
i
Transparent Proxy with Linux and Squid
mini−HOWTO
Daniel Kiracofe
v1.15, August 2002
This document provides information on how to setup a transparent caching HTTP proxy server using only
Linux and squid.
1.
Introduction
·
1.2 Copyrights and Trademarks
1.1 Comments
·
1.3 #include <disclaimer.h>
·
2.
Overview of Transparent Proxying
·
2.2 Scope of this document
2.1 Motivation
·
2.3 HTTPS
·
2.4 Proxy Authentication
·
3.
Configuring the Kernel
4.
Setting up squid
5.
Setting up iptables (Netfilter)
6.
Transparent Proxy to a Remote Box
·
6.2 Second method (more complicated, but more general)
6.1 First method (simpler, but does not work for some esoteric cases)
·
6.3 Method One: What if iptables−box is on a dynamic IP?
·
7.
Transparent Proxy With Bridging
8.
Put it all together
9.
Troubleshooting
Transparent Proxy with Linux and Squid mini−HOWTO
1
Transparent Proxy with Linux and Squid mini−HOWTO
10.
Further Resources
1.
Introduction
1.1 Comments
Comments and general feedback on this mini HOWTO are welcome and can be directed to its author, Daniel
Kiracofe, at drk@unxsoft.com.
1.2 Copyrights and Trademarks
Copyright 2000−2002 by Daniel Kiracofe
This manual may be reproduced in whole or in part, without fee, subject to the following restrictions:
·
The copyright notice above and this permission notice must be preserved complete on all complete or
partial copies
·
Translation to another language is permitted, provided that the author is notified prior to the
translation.
·
If you distribute this work in part, instructions for obtaining the complete version of this manual must
be included, and a means for obtaining a complete version provided.
Any derived work must be approved by the author in writing before distribution.
·
·
Small portions may be reproduced as illustrations for reviews or quotes in other works without this
permission notice if proper citation is given.
Exceptions to these rules may be granted for academic purposes: Write to the author and ask. These
restrictions are here to protect us as authors, not to restrict you as learners and educators. Any source code
(aside from the SGML this document was written in) in this document is placed under the GNU General
Public License, available via anonymous FTP from the GNU archive.
1.3 #include <disclaimer.h>
No warranty, expressed or implied, etc, etc, etc...
2.
Overview of Transparent Proxying
2.1 Motivation
In ``ordinary'' proxying, the client specifies the hostname and port number of a proxy in his web browsing
software. The browser then makes requests to the proxy, and the proxy forwards them to the origin servers.
This is all fine and good, but sometimes one of several situations arise. Either
·
You want clients to use a proxy, but don't want them to know they're being proxied.
You want to force clients on your network to use the proxy, whether they want to or not.
·
You want clients to be proxied, but don't want to go to all the work of updating the settings in
hundreds or thousands of web browsers.
·
10. Further Resources
2
Transparent Proxy with Linux and Squid mini−HOWTO
This is where transparent proxying comes in. A web request can be intercepted by the proxy, transparently.
That is, as far as the client software knows, it is talking to the origin server itself, when it is really talking to
the proxy server. (Note that the transparency only applies to the client; the server knows that a proxy is
involved, and will see the IP address of the proxy, not the IP address of the user. Although, squid may pass an
X−Forwarded−For header, so that the server can determine the original user's IP address if it groks that
header).
Cisco routers support transparent proxying. So do many switches. But, (surprisingly enough) Linux can act as
a router, and can perform transparent proxying by redirecting TCP connections to local ports. However, we
also need to make our web proxy aware of the affect of the redirection, so that it can make connections to the
proper origin servers. There are two general ways this works:
The first is when your web proxy is not transparent proxy aware. You can use a nifty little daemon called
transproxy that sits in front of your web proxy and takes care of all the messy details for you. transproxy was
written by John Saunders, and is available from
ftp://ftp.nlc.net.au/pub/linux/www/
or your local metalab mirror. transproxy will not be discussed further in
this document.
A cleaner solution is to get a web proxy that is aware of transparent proxying itself. The one we are going to
focus on here is squid. Squid is an Open Source caching proxy server for Unix systems. It is available from
www.squid−cache.org
Alternatively, instead of redirecting the connections to local ports, we could redirect the connections to remote
ports. This is discussed in the
Transparent Proxy to a Remote Box
section. Readers interested in this approach
should skip down to that section. Readers interested on doing everything on one box can safely ignore that
section.
2.2 Scope of this document
This document will focus on squid version 2.4 and Linux kernel version 2.4, the most current stable releases
as of this writing (August 2002). It should also work with most of the later 2.3 kernels. If you need
information about earlier releases of squid or Linux, you can find some earlier documents at
http://users.gurulink.com/transproxy/
.
Note that this site has moved from it's previous location.
If you are using a development kernel or a development version of squid, you are on your own. This
document may help you, but YMMV.
Note that this document focuses only on HTTP proxing. I get many emails asking about transparent FTP
proxying. Squid can't do it. Now, allegedly a program called Frox can. I have not tried this myself, so I cannot
say how well it works. You can find it at
http://www.hollo32.fsnet.co.uk/frox/
.
I only focus on squid here, but Apache can also function as a caching proxy server. (If you are not sure which
to use, I recommend squid, since it was built from the ground up to be a caching proxy server, Apache's
caching proxy features are more of afterthought additions to an already existing system.) If you want use
Apache instead of squid: follow all the instructions in this document that pertain to the kernel and iptables
rules. Ignore the squid specific sections, and instead look at
http://lupo.campus.uniroma2.it/progetti/mod_tproxy/
for source code and instructions for a transparent proxy
module for Apache (thanks to Cristiano Paris (c.paris@libero.it) for contributing this).
2.2 Scope of this document
3
Plik z chomika:
megaskrypty
Inne pliki z tego folderu:
3-Button-Mouse(1).pdf
(58 KB)
XWindow-Overview-HOWTO(1).pdf
(30 KB)
Xterm-Title(1).pdf
(39 KB)
Xterminals(1).pdf
(30 KB)
Xinerama-HOWTO(1).pdf
(33 KB)
Inne foldery tego chomika:
Programowanie
Zgłoś jeśli
naruszono regulamin