LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
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-06-2002, 02:30 PM   #1
rruth
LQ Newbie
 
Registered: Dec 2002
Posts: 4

Rep: Reputation: 0
iptables help


I have squid installed on my desktop and am looking to redirect all outbound http traffic through port 3128 on my local machine.

I have read the transparent proxy howto and can't seem to get this to work.

Any help w/ the proper iptables rule would be appreciated....

Here is the default Redhat iptables script I am running:

*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
:RH-Lokkit-0-50-INPUT - [0:0]
-A INPUT -j RH-Lokkit-0-50-INPUT
-A RH-Lokkit-0-50-INPUT -p tcp -m tcp --dport 22 --syn -j ACCEPT
-A RH-Lokkit-0-50-INPUT -p udp -m udp -s 0/0 --sport 67:68 -d 0/0 --dport 67:68 -i eth0 -j ACCEPT
-A RH-Lokkit-0-50-INPUT -p udp -m udp -s 0/0 --sport 67:68 -d 0/0 --dport 67:68 -i eth1 -j ACCEPT
-A RH-Lokkit-0-50-INPUT -i lo -j ACCEPT
-A RH-Lokkit-0-50-INPUT -p udp -m udp -s 192.168.1.5 --sport 53 -d 0/0 -j ACCEPT
-A RH-Lokkit-0-50-INPUT -p tcp -m tcp --syn -j REJECT
-A RH-Lokkit-0-50-INPUT -p udp -m udp -j REJECT
COMMIT
 
Old 12-07-2002, 08:07 AM   #2
peter_robb
Senior Member
 
Registered: Feb 2002
Location: Szczecin, Poland
Distribution: Gentoo, Debian
Posts: 2,458

Rep: Reputation: 48
iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-ports 3128
service iptables save

This will send any requests for http port 80 to squid on this machine, and save the rule for later.

You should also seriously look at getting some better rules if you are acting as a gateway for a Lan behind you.
Have a look at this tutorial and this firewall tool... http://firestarter.sourceforge.net/
 
Old 12-07-2002, 04:44 PM   #3
rruth
LQ Newbie
 
Registered: Dec 2002
Posts: 4

Original Poster
Rep: Reputation: 0
thanks

Actually, no machines will be proxying through this box. This setup is strictly for development/test purposes.

The rule you stated is all over the net.... Even w/ that rule I am not redirected. If I bring up a browser on the same machine running iptables and squid with the rule you stated enabled I am not redirected to port 3128.

-Rob

p.s. yes, ip forwarding is enabled
 
Old 12-07-2002, 05:12 PM   #4
peter_robb
Senior Member
 
Registered: Feb 2002
Location: Szczecin, Poland
Distribution: Gentoo, Debian
Posts: 2,458

Rep: Reputation: 48
What happens if you set the browser's proxy setting to your outgoing ip number and port 80?
Usually, if you send proxy request headers to squid, it will honour them.
Just now have to find out which component needs to be tweaked...

Add a rule via lokkit to ACCEPT 3128 tcp for interfaces lo & local lan interface.
 
Old 12-07-2002, 06:58 PM   #5
rruth
LQ Newbie
 
Registered: Dec 2002
Posts: 4

Original Poster
Rep: Reputation: 0
I'll give that a shot...

If I set my browser to use http://:127.0.0.1:3128 everything works fine. I am trying to avoid having to add anything to the browser which is why I need iptables...

I'll give your suggestion a shot and let you know....

Thanks for your help!

-Rob
 
  


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
An error occured getting IPtables status from the command /etc/rc.d/init.d/iptables s CrazyMAzeY Linux - Newbie 10 08-12-2010 05:25 AM
Iptables - Couldn't load target `ACCPET':/lib/iptables/libipt_ACCPET.so: z00t Linux - Security 3 01-26-2004 02:24 AM
IPtables Log Analyzer from http://www.gege.org/iptables/ brainlego Linux - Software 0 08-11-2003 06:08 AM
iptables book wich one can you pll recomment to be an iptables expert? linuxownt Linux - General 2 06-26-2003 04:38 PM
My iptables script is /etc/sysconfig/iptables. How do i make this baby execute on boo ForumKid Linux - General 3 01-22-2002 07:36 AM

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

All times are GMT -5. The time now is 08:39 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