Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
05-11-2005, 03:38 AM
|
#1
|
Member
Registered: Jun 2004
Location: Melbourne, Australia
Posts: 47
Rep:
|
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.
|
|
|
05-11-2005, 05:34 PM
|
#2
|
LQ Guru
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870
|
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.
|
|
|
05-11-2005, 06:09 PM
|
#3
|
LQ Guru
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870
|
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.
|
|
|
05-11-2005, 09:19 PM
|
#4
|
Member
Registered: Jun 2004
Location: Melbourne, Australia
Posts: 47
Original Poster
Rep:
|
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.
|
|
|
05-11-2005, 09:27 PM
|
#5
|
LQ Guru
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870
|
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...
|
|
|
05-11-2005, 11:08 PM
|
#6
|
Member
Registered: Jun 2004
Location: Melbourne, Australia
Posts: 47
Original Poster
Rep:
|
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.
|
|
|
05-12-2005, 01:26 AM
|
#7
|
LQ Guru
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870
|
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.
|
|
|
05-12-2005, 04:52 AM
|
#8
|
Member
Registered: Jun 2004
Location: Melbourne, Australia
Posts: 47
Original Poster
Rep:
|
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.
|
|
|
All times are GMT -5. The time now is 01:28 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|