netfilter.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* transparent proxy
@ 2010-03-09 23:44 Marco Schuth
  2010-03-10  0:23 ` Amos Jeffries
  0 siblings, 1 reply; 22+ messages in thread
From: Marco Schuth @ 2010-03-09 23:44 UTC (permalink / raw)
  To: netfilter


Hello,

Iam using iptables on my router, and have a dedicated proxy server with 
squid sarg and squidguard running.

all the clients send the request for a website to the default gw (router 
10.12.0.1) the router redirects (dnat)
the package to the proxy server ip:10.12.0.250
but in the logs i get the ip from the router.

so squid guard doesent work and the squid analytic didn´t work because it 
shows only the ip from the gw (router) with all requestet pages.

how can i change this, that i get in the logs the original ip of the clients 
?

-----------------------
maybe: snat with the original ip, but how? and make a second entry in the 
proxy to send all packets back to the proxy ?

no idea.

thanks 4 you help!!! 


^ permalink raw reply	[flat|nested] 22+ messages in thread
* RE: transparent proxy
@ 2004-03-17 12:33 Fredrik Emil Jensen
  2004-03-17 14:21 ` David Cannings
  0 siblings, 1 reply; 22+ messages in thread
From: Fredrik Emil Jensen @ 2004-03-17 12:33 UTC (permalink / raw)
  To: Netfilter

Thank you Antony, finally it's working for me.  I have another question
for the list; is it possible to use iptables to redirect any request on
port 80 to a specific web address? 

I know you can use the rule, iptables -t nat -A PREROUTING -p tcp -s
192.168.1.0/24 -d 0/0 --dport 80 -j DNAT --to ip.address.xx.xx:80

But my problem occurs when you have many different subnets and you want
subnet1 to be redirected to http://test.domain.com/site1, subnet2 to be
redirected to http://test.domain.com/site2 etc.

Does anyone have any suggestions on how to do this with iptables, is it
possible? Or do I still need to use squid and squidGuard!

Regards, 
Fredrik

-----Original Message-----
From: Antony Stone [mailto:Antony@Soft-Solutions.co.uk] 
Sent: 16. mars 2004 09:44
To: Netfilter
Subject: Re: transparent proxy

On Monday 15 March 2004 9:19 am, Fredrik Emil Jensen wrote:

> Hey
>
> I'm currently using squid and squidGuard for redirection. Setting up
the
> rules:
>
> Iptables -t nat -A PREROUTING -p tcp -s 192.168.1.0/24 -d 0/0 --dport
80
> -j REDIRECT --to-ports 3128
>
> But does anyone know what to do if you want to use iptables to bypass
> squid with single IP address?

Yes, put a rule above that one in the PREROUTING chain which matches the

source address you don't want to be REDIRECTed, and jump out of the
chain:

iptables -I PREROUTING -t nat -p tcp -s 192.168.1.10 --dport 80 -j
ACCEPT

That will match a single address, 192.168.1.10, TCP port 80, and make
sure the 
following REDIRECT rule is not activted.   Note the "-I" to insert the
rule 
at the top of the list, instead of the more common "-A" which appends to
the 
end of the list.

Regards,

Antony.



^ permalink raw reply	[flat|nested] 22+ messages in thread
* RE: transparent proxy
@ 2004-03-15  9:19 Fredrik Emil Jensen
  2004-03-16  1:57 ` Alexander Samad
  2004-03-16  8:44 ` Antony Stone
  0 siblings, 2 replies; 22+ messages in thread
From: Fredrik Emil Jensen @ 2004-03-15  9:19 UTC (permalink / raw)
  To: Netfilter

Hey 

I'm currently using squid and squidGuard for redirection. Setting up the
rules:

Iptables -t nat -A PREROUTING -p tcp -s 192.168.1.0/24 -d 0/0 --dport 80
-j REDIRECT --to-ports 3128 

But does anyone know what to do if you want to use iptables to bypass
squid with single IP address?

I know that you can add the rule "iptables -t nat -A POSTROUTING -o eth0
-s 192.168.1.10/32 -d 0/0 -j SNAT --to "source_Wan_address" ". But this
rule will be added at the end of the rule list, and all traffic on port
80 will still be redirected through squid. Even when I use priority
"iptables -t nat -I POSTROUTING 1 etc" and I put higher priority on the
rule for the bypass IP, it is still being redirected through squid. I
have to remove the redirect rule before I can bypass squid. 

Does anyone know what I'm doing wrong?

Using Slackware 9.1 with Kernel 2.6.2, iptables version 1.2.9 and squid
2.5

Regards, 
Fredrik

-----Original Message-----
From: Daniel F. Chief Security Engineer -
[mailto:danielf@supportteam.net] 
Sent: 27. februar 2004 18:01
To: Tomasz Macioszek; Netfilter
Subject: Re: transparent proxy

That rule should work fine, make sure you compiled squid with:

./configure --enable-linux-netfilter 

But for more usefull info :)
Here is a nice HOW-TO
http://en.tldp.org/HOWTO/TransparentProxy.html


On Friday 27 February 2004 02:48, Tomasz Macioszek wrote:
> Hello!
> I have a Linux server acting as a gateway between internal network and
> internet. The iptables rule set have been working  good for long time.
> I have configured squid on this server. When I have set internal
network
> client to use directly proxy server it has worked properly. But when I
have
> set iptable to redirect all http traffic to squid  port (3128) it
didn't
> work (transparent proxy).
> This is my iptable rule:
> iptables -t nat -A PREROUTING -p TCP --dport 80 -j REDIRECT --to-port
3128
> I think that all options in my kernel are set properly.
> I don't know why it doesn't work
> I set tcpdump to listen on 3128 port and when client tried to connect
to
> web server on port 3128 showed only first IP  package of this
connection
> and connections failed.
> Could you send me a solution for this problem?
> Best regards
> Tomek

-- 
_,.-:*"``'*:-.,_,.-:*"``'*:-.,_,.-:*"``'*:-.,_,.-:*"``'*:-.,_,.-:*"``'*:
-.,_
Daniel Fairchild - Chief Security Officer | danielf@supportteam.net
The distance between nothing and infinity is always the same no matter
how 
close you get to nothing.





^ permalink raw reply	[flat|nested] 22+ messages in thread
* RE: transparent proxy
@ 2004-02-27 19:19 Guillermo Chui Lau
  0 siblings, 0 replies; 22+ messages in thread
From: Guillermo Chui Lau @ 2004-02-27 19:19 UTC (permalink / raw)
  To: netfilter; +Cc: tomekm

On Fri, 27 Feb 2004 09:48:39 +0100
"Tomasz Macioszek" <tomekm@cea.pl> wrote:

> Hello!
> I have a Linux server acting as a gateway between internal network and
> internet. The iptables rule set have been working  good for long time.
> I have configured squid on this server. When I have set internal network
> client to use directly proxy server it has worked properly. But when I
have
> set iptable to redirect all http traffic to squid  port (3128) it didn't
> work (transparent proxy).
> This is my iptable rule:
> iptables -t nat -A PREROUTING -p TCP --dport 80 -j REDIRECT --to-port 3128
> I think that all options in my kernel are set properly.
> I don't know why it doesn't work
> I set tcpdump to listen on 3128 port and when client tried to connect to
web
> server on port 3128 showed only first IP  package of this connection and
> connections failed.
> Could you send me a solution for this problem?
> Best regards
> Tomek
> 
> 

YOU NEED TO IMPLEMENT THIS RULE

iptables  -t nat -A PREROUTING -i $LAN_IFACE -p tcp --dport 80 \
-j REDIRECT --to-port 3128

LINUX SERVER HACKS Rob Flickenger

also make squid run in levels 3 ,4 and 5

chkconfig --level 345 squid on

if this doesnt work see if the iptables is doing  nat you should have a rule
like this one

iptables -t nat -A POSTROUTING -o $INET_IFACE -j SNAT --to-source $INET_IP

also check if you are loading the modules

/sbin/modprobe ip_tables
/sbin/modprobe ip_conntrack
/sbin/modprobe iptable_filter
/sbin/modprobe iptable_mangle
/sbin/modprobe iptable_nat
/sbin/modprobe ipt_LOG
/sbin/modprobe ipt_limit
/sbin/modprobe ipt_state

you can check the modules using lsmod

Guillermo Chui Lau
Support Enginner


^ permalink raw reply	[flat|nested] 22+ messages in thread
* transparent proxy
@ 2004-02-27  8:48 Tomasz Macioszek
  2004-02-27  9:18 ` Jeroen Vriesman
                   ` (2 more replies)
  0 siblings, 3 replies; 22+ messages in thread
From: Tomasz Macioszek @ 2004-02-27  8:48 UTC (permalink / raw)
  To: Netfilter

Hello!
I have a Linux server acting as a gateway between internal network and
internet. The iptables rule set have been working  good for long time.
I have configured squid on this server. When I have set internal network
client to use directly proxy server it has worked properly. But when I have
set iptable to redirect all http traffic to squid  port (3128) it didn't
work (transparent proxy).
This is my iptable rule:
iptables -t nat -A PREROUTING -p TCP --dport 80 -j REDIRECT --to-port 3128
I think that all options in my kernel are set properly.
I don't know why it doesn't work
I set tcpdump to listen on 3128 port and when client tried to connect to web
server on port 3128 showed only first IP  package of this connection and
connections failed.
Could you send me a solution for this problem?
Best regards
Tomek



^ permalink raw reply	[flat|nested] 22+ messages in thread
* Transparent Proxy
@ 2003-09-10 21:19 Kilson Arruda
  0 siblings, 0 replies; 22+ messages in thread
From: Kilson Arruda @ 2003-09-10 21:19 UTC (permalink / raw)
  To: netfilter

I have a Transparent Proxy like this

$IPTABLES -t nat -A PREROUTING -p tcp
--dport 80 ! -d $DIRECT_IP -m mac --mac-source $MAC -j REDIRECT --to-port
3128

Question: can I use more then one "! -d", or multiple IPs to don't REDIRECT
the port 80 for more then one IP?
If yes, how can I do this?

--
Kilson Arruda
Linux User # 228238


________________________________________________
www.onwave.com.br - Internet e Conectividade



^ permalink raw reply	[flat|nested] 22+ messages in thread
* Transparent Proxy
@ 2002-11-25 13:04 Cyril COUPEL
  0 siblings, 0 replies; 22+ messages in thread
From: Cyril COUPEL @ 2002-11-25 13:04 UTC (permalink / raw)
  To: netfilter

[-- Attachment #1: Type: text/plain, Size: 605 bytes --]

Hi all,
First here is my network architecture:
3 Linux Box, B act has router (A and C can even be a group of PCs):

------     ------     ------
|  A  |----|  B  |----|  C  |
------     ------     ------

I need to REDIRECT (DNAT) the traffic from A to B, to a kind of PROXY,
and then forward it to C.

For it, I need to retreave on B the real server address requested by A
to open a new connection from B to C.

My Question is:
How to retreave  the conntrack informations for a connection, without
parsing the /proc/net/ipv4/ip_conntrack?

Thank in advance.
-- 
Cyril COUPEL <cyril@coupel.homelinux.org>

[-- Attachment #2: Type: text/html, Size: 1155 bytes --]

^ permalink raw reply	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2010-03-13 21:58 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-09 23:44 transparent proxy Marco Schuth
2010-03-10  0:23 ` Amos Jeffries
2010-03-13  8:21   ` Mart Frauenlob
2010-03-13 10:05     ` /dev/rob0
2010-03-13 12:08       ` Mart Frauenlob
2010-03-13 12:11         ` Mart Frauenlob
2010-03-13 16:41         ` /dev/rob0
2010-03-13 21:58           ` Mart Frauenlob
  -- strict thread matches above, loose matches on Subject: below --
2004-03-17 12:33 Fredrik Emil Jensen
2004-03-17 14:21 ` David Cannings
2004-03-15  9:19 Fredrik Emil Jensen
2004-03-16  1:57 ` Alexander Samad
2004-03-16  8:44 ` Antony Stone
2004-02-27 19:19 Guillermo Chui Lau
2004-02-27  8:48 Tomasz Macioszek
2004-02-27  9:18 ` Jeroen Vriesman
2004-02-27  9:27   ` Antony Stone
2004-02-27 10:25     ` Jeroen Vriesman
2004-02-27 11:50 ` John A. Sullivan III
2004-02-27 17:00 ` Daniel F. Chief Security Engineer -
2003-09-10 21:19 Transparent Proxy Kilson Arruda
2002-11-25 13:04 Cyril COUPEL

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).