LinuxQuestions.org
Help answer threads with 0 replies.
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 05-11-2005, 03:38 AM   #1
gjhicks
Member
 
Registered: Jun 2004
Location: Melbourne, Australia
Posts: 47

Rep: Reputation: 15
Only allow HTTP access through proxy?


Hello,

Have got a linux server working, with 2 NICs, using firestarter and privoxy, taking data from a adsl modem/router and feeding it to a wireless based lan.

All seems to be fine and the privoxy stuff works but the downstream lan users can still bypass the proxy, by just not setting the proxy, that is by direct access to http via port 80.

I am sure that this can be blocked/denied by a call to iptables (which I use for nat) but can't figure out the exact syntax.

Would appreciate some assistance.

Regards,

Geoff.
 
Old 05-11-2005, 05:34 PM   #2
win32sux
Guru
 
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870

Rep: Reputation: 371Reputation: 371Reputation: 371Reputation: 371
sounds like what you want to do is transparent proxying... by doing it like this, all tcp port 80 packets going from the lan to the internet will be redirected automatically to the proxy... this way the machines on the lan don't even need to be configured to use a proxy, the proxying becomes transparent to the users on the lan... this is what the iptables rule would look like if eth1 is your lan interface and your proxy is listening on port 3128:
Code:
iptables -t nat -A PREROUTING -p TCP -i eth1 --dport 80 \
-j REDIRECT --to-ports 3128
also keep in mind that you'll probably need to configure your privoxy to be able to work transparently... i'm not sure how that works with privoxy, but on squid basically all you need to do is add these lines to your squid.conf:
Code:
httpd_accel_host virtual
httpd_accel_port 80
httpd_accel_with_proxy on
httpd_accel_uses_host_header on
squid would also need to be compiled using the --enable-linux-netfilter option...

http://www.tldp.org/HOWTO/TransparentProxy.html

just my , good luck...


Last edited by win32sux; 05-11-2005 at 05:47 PM.
 
Old 05-11-2005, 06:09 PM   #3
win32sux
Guru
 
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870

Rep: Reputation: 371Reputation: 371Reputation: 371Reputation: 371
i just found this in the Privoxy Faq (Section 3.18):
Quote:
Can Privoxy run as a "transparent" proxy?

No, Privoxy currently does not have this ability, though it is planned for a future release. Transparent proxies require special handling of the request headers beyond what Privoxy is now capable of.

Chaining Privoxy behind another proxy that has this ability should work though. See the forwarding chapter in the user manual.
so it looks like for now you'd have to install something like squid anyways in order to get privoxy to work in a transparent fashion for your lan...


Last edited by win32sux; 05-11-2005 at 06:12 PM.
 
Old 05-11-2005, 09:19 PM   #4
gjhicks
Member
 
Registered: Jun 2004
Location: Melbourne, Australia
Posts: 47

Original Poster
Rep: Reputation: 15
Thanks for your help. This is proving to be a fair bit more complicated than I expected. But with kids and the internet, what is the choice?

One other question, in you post you mention:

sounds like what you want to do is transparent proxying... by doing it like this, all tcp port 80 packets going from the lan to the internet will be redirected automatically to the proxy...

Sorry to appear thick but what about the tcp port 80 packets going from the internet to the lan?

Regards,

Geoff.
 
Old 05-11-2005, 09:27 PM   #5
win32sux
Guru
 
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870

Rep: Reputation: 371Reputation: 371Reputation: 371Reputation: 371
Quote:
Originally posted by gjhicks
but what about the tcp port 80 packets going from the internet to the lan?
there wouldn't be any... the machines on your lan would be establishing a connection to the proxy server... the proxy server would establish a connection to the internet... there wouldn't be any 80/tcp connection between the lan and the internet at any point...
 
Old 05-11-2005, 11:08 PM   #6
gjhicks
Member
 
Registered: Jun 2004
Location: Melbourne, Australia
Posts: 47

Original Poster
Rep: Reputation: 15
thanks again, I guess I should have tumbled to that.

I don't mind having to configure the kids computers to use the privoxy port but, as I said earlier, denying access to the "raw" http port 80 is also an aim.

Am I right in assuming that the code mentioned above:

iptables -t nat -A PREROUTING -p TCP -i eth1 --dport 80 \
-j REDIRECT --to-ports 3128

will mean that computers on the lan connected via eth1 will not have access to port 80?

thanks and regards,

Geoff.
 
Old 05-12-2005, 01:26 AM   #7
win32sux
Guru
 
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870

Rep: Reputation: 371Reputation: 371Reputation: 371Reputation: 371
i see what you mean now...

in that case, you can block all forwarding of 80/TCP packets by executing this command (assuming eth1 is your LAN interface):

Code:
iptables -I FORWARD -p TCP -i eth1 --dport 80 -j REJECT
this would prevent them from surfing the web directly through the NAT firewall, so they'd only be able to do it by connecting to the privoxy port...

if you don't wanna mess with your current firewall configuration just add that command to your startup file (maybe rc.local) and you should be fine...

by doing it like this you don't need to worry about the transparent proxying stuff anymore...

i hope this helps... good luck!!!


Last edited by win32sux; 05-12-2005 at 01:41 AM.
 
Old 05-12-2005, 04:52 AM   #8
gjhicks
Member
 
Registered: Jun 2004
Location: Melbourne, Australia
Posts: 47

Original Poster
Rep: Reputation: 15
Yes, I just want a way to deny the lan users access to the "usual" http port.

Thanks a lot for your assistance.

Regards,

Geoff.
 
  


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


Similar Threads
Thread Thread Starter Forum Replies Last Post
http proxy server Seiken Slackware 6 12-09-2005 12:03 PM
http proxy tunneling xowl Linux - Networking 1 02-22-2005 12:41 PM
"socks5" -> "http" proxy protocol, or ssh tunnel to sock5 ? I'm beyond http p vmicho Linux - Networking 2 12-16-2003 05:32 AM
BitchX through a HTTP Proxy? eggs Linux - Software 1 07-11-2003 06:43 PM
ntpdate through http proxy thas Linux - Networking 0 05-14-2003 01:50 PM


All times are GMT -5. The time now is 10:16 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 Google+: linuxquestions
Open Source Consulting | Domain Registration