LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 12-21-2004, 05:40 AM   #1
mchanea
LQ Newbie
 
Registered: Jan 2004
Location: Rio de Janeiro - Brasil
Distribution: debian/rh
Posts: 18

Rep: Reputation: 0
Iptables mac-match VS. transparent proxy


I made an ipXmac matching policy on my firewall to allow only matching users to have any kind of access, but the problem is that I also have a transparent proxy rule that won't work anymore.
Here's my NAT'S prerouting table:

Chain PREROUTING (policy ACCEPT)
target prot source destination
ACCEPT all -- 192.168.10.69 0.0.0.0/0 MAC 02:02:A5:XX:XX:XX
ACCEPT all -- 192.168.10.73 0.0.0.0/0 MAC 00:0C:6E:XX:XX:XX
ACCEPT all -- 192.168.10.70 0.0.0.0/0 MAC 00:11:2F:XX:XX:XX
DROP all -- 192.168.10.0/24 0.0.0.0/0
REDIRECT tcp -- 192.168.10.0/24 0.0.0.0/0 tcp dpt:80 redir ports 3128

Example: The user with the IP 192.168.10.69 will only have granted access (ACCEPT) if his NIC's MAC will be 02:02:A5:XX:XX:XX.
The problem is that the last rule (the transparent proxy's one) is being ignored. It means, as soon as the user is accepted by the mac-match rule, it goes directly to the port 80 it's requesting, it's not being redirected to the port 3128.
Any ideas?

Marcelo Chanea,
Rio de Janeiro, Brasil.
 
Old 12-21-2004, 08:39 AM   #2
Capt_Caveman
Senior Member
 
Registered: Mar 2003
Distribution: Fedora
Posts: 3,658

Rep: Reputation: 69
Try putting the REDIRECT rule earlier on. It looks like the "DROP all -- 192.168.10.0/24 0.0.0.0/0 " rule will drop the same packets that the REDIRECT rule is trying to redirect. Because the drop target is "chain-terminating" the packets will never reach the redirect rule.

It also might help to post your firewall script, because the accept and drop rules in the prerouting chain look like they are in the wrong place (they look like they should be in INPUT or FORWARD).
 
Old 12-22-2004, 05:41 AM   #3
newpenguin
Member
 
Registered: Sep 2002
Location: lahore pakistan
Distribution: slackware,redhat, FreeBSD,openbsd
Posts: 219

Rep: Reputation: 30
do the filtering stuff in mangle table's prerouting chain.

do the nat in nat table.
 
Old 12-22-2004, 06:30 AM   #4
mchanea
LQ Newbie
 
Registered: Jan 2004
Location: Rio de Janeiro - Brasil
Distribution: debian/rh
Posts: 18

Original Poster
Rep: Reputation: 0
The problem is that if I put the Redirect rule right before the Drop one, it will still not work because as soon as the packets pass through the Accept rule they will go out immediately from the NAT table to the Filter table.
The only thing I need is that in first place the IP/MAC matching might be checked and if they match (ie the user is accepted) the packets that have the 80 port as destination will be redirected to the squid, otherwise, follow to the filter table.
just to make it clear, I also have the same rules for IP/Mac matching on the Filter Forward table.

About the mangle table, could you be more specific? The only use I've ever made in mangle was marking packets. Is the mangle table read before the NAT table? Do you know any link on the internet that shows the exact order of the netfilter tables?
 
Old 12-22-2004, 06:42 AM   #5
mchanea
LQ Newbie
 
Registered: Jan 2004
Location: Rio de Janeiro - Brasil
Distribution: debian/rh
Posts: 18

Original Poster
Rep: Reputation: 0
I asked about the Netfilter order and I have just found an excellent link:


http://www.faqs.org/docs/iptables/tr...goftables.html

I will study it deeply to see if it helps.
 
  


Reply



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
transparent proxy mattsthe2 Linux - Networking 9 10-26-2005 08:44 AM
Transparent Proxy krock923 Linux - Networking 1 04-28-2005 06:43 PM
Iptables+transparent Proxy seitan Linux - Networking 11 12-13-2004 08:42 PM
Transparent Proxy ilnli Linux - Networking 3 10-18-2004 06:01 PM
Transparent Proxy vinhhv Linux - Networking 0 07-23-2003 01:01 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 09:19 PM.

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