LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 06-30-2005, 01:00 AM   #1
TheAce
LQ Newbie
 
Registered: Jun 2005
Location: Indonesia
Distribution: Mepis, Debian Sarge
Posts: 15

Rep: Reputation: 0
Question URL Filtering in NAT+BIND9


Hi all, first time posting in these forums..

I have Mepis Linux setup with NAT and BIND9( as a cached DNS) to allow the LAN computers to access the internet. I need to setup URL filtering to block access to porn sites (as this is company policy).

Is it possible to do this Just with NAT and BIND or do I have to setup a proxy server ? If it is possible, what should I do ?

Thanks.
 
Old 06-30-2005, 04:15 AM   #2
sind
Member
 
Registered: Jun 2005
Posts: 75

Rep: Reputation: 15
I don't know much about BIND, so I can't comment on that, but you could block outgoing/forwarded traffic to certain sites using iptables (I assume that's what you're using for NAT). If the list of banned sites is continually growing, you could probably just insert more rules into the chain as more sites are added. If the IP of a site changes, you might need to restart the firewall to resolve the new address. As such you can't really filter URL's with iptables (or BIND, I would have thought), only domain names/IPs.

I was in a similar situation at a school where I was the administrator. We used Squid to determine who could use the web and where they could go. A couple of nice things about using Squid rather than iptables would be that you can use regular expressions in access controls (both for domains and URLs), and you can return a nice error page to tell the user that they were trying to do something naughty.

~sind
 
Old 06-30-2005, 04:23 AM   #3
TheAce
LQ Newbie
 
Registered: Jun 2005
Location: Indonesia
Distribution: Mepis, Debian Sarge
Posts: 15

Original Poster
Rep: Reputation: 0
Quote:
Originally posted by sind
but you could block outgoing/forwarded traffic to certain sites using iptables (I assume that's what you're using for NAT).
This is exactly what I want to do. The question is how ?
Quote:
As such you can't really filter URL's with iptables (or BIND, I would have thought), only domain names/IPs.
if it can do partial domain names or domain names with wildcard filtering then that would solve my problem as well.

Quote:
I was in a similar situation at a school where I was the administrator. We used Squid to determine who could use the web and where they could go. A couple of nice things about using Squid rather than iptables would be that you can use regular expressions in access controls (both for domains and URLs), and you can return a nice error page to tell the user that they were trying to do something naughty.

~sind [/B]
Yes I know that but proxy server is not an option I got
 
Old 06-30-2005, 06:22 AM   #4
sind
Member
 
Registered: Jun 2005
Posts: 75

Rep: Reputation: 15
You should be able to specify a hostname in a rule like so (for example):

# iptables -A FORWARD -d www.google.com -j REJECT

It says in the man page for iptables that that syntax is valid, however iptables on my machine wouldn't let me do it. I think there must be a bug in the version that I have.

I remember using a rule like that to allow telnet access from a dynamic domain name to a server (using ipchains), the main problem was that the name was resolved when the rule was added, and so when the address of the dynamic domain name changed, access was blocked... And then access was opened to whoever got the IP address next... :-|

Anyway, that was a different situation. Hopefully the sites you want to block have fairly constant IPs.

HTH,
~sind
 
Old 06-30-2005, 06:26 AM   #5
TheAce
LQ Newbie
 
Registered: Jun 2005
Location: Indonesia
Distribution: Mepis, Debian Sarge
Posts: 15

Original Poster
Rep: Reputation: 0
thanks. I'll try this one.
 
Old 11-04-2005, 12:40 AM   #6
jeffvph
LQ Newbie
 
Registered: Jul 2005
Posts: 26

Rep: Reputation: 15
Hi, I was wondering what version of iptables will it work. It doesn't work on my machine running redhat 9 with iptables v1.2.7a. Will there be any problems if I upgrade iptables?

I will very much appreciate your response.

Thanks

Jeff
 
Old 11-06-2005, 08:35 PM   #7
TheAce
LQ Newbie
 
Registered: Jun 2005
Location: Indonesia
Distribution: Mepis, Debian Sarge
Posts: 15

Original Poster
Rep: Reputation: 0
How do I find the version of iptables ? What I have is the iptables that comes with the 2.6 kernel.

Incidentally this method works but its a real pain to maintain the list of banned sites. Using proxy server with ACLs is muvh better way to do it.
 
Old 11-08-2005, 01:35 AM   #8
jeffvph
LQ Newbie
 
Registered: Jul 2005
Posts: 26

Rep: Reputation: 15
Run this command:

#iptables --version

What I did is a white list of sites every host needed to access, sites that are not listed are droped. My current setup use the IP address filtering and what I need is the domain name filtering but unfortunately it doesn't work on my version of iptables.
 
Old 11-08-2005, 01:40 AM   #9
TheAce
LQ Newbie
 
Registered: Jun 2005
Location: Indonesia
Distribution: Mepis, Debian Sarge
Posts: 15

Original Poster
Rep: Reputation: 0
the version I have is 1.2.11

though I have stopped using this method and am now using Squid with ACLs.
 
  


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
ERROR The requested URL could not be retrieved While trying to retrieve the URL: /re Niceman2005 Linux - General 1 06-29-2005 09:51 AM
set URL filtering in mozilla Trio3b Linux - Security 2 04-15-2005 06:19 AM
url filtering using Squid RajaRC Red Hat 1 11-07-2003 07:21 AM
Web filtering: URL filt or rate content..or? Linux Learning Linux - Security 2 10-01-2003 07:46 AM
Sendmail Spam filtering and Virus filtering MrJoshua Linux - General 2 04-03-2003 10:12 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

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