LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Debian (https://www.linuxquestions.org/questions/debian-26/)
-   -   Give access to website in /etc/host (https://www.linuxquestions.org/questions/debian-26/give-access-to-website-in-etc-host-801726/)

rob33n 04-13-2010 06:45 AM

Give access to website in /etc/host
 
I want to give some web address to host file and except these web address no website will open.
For example I give permission for www.google.com and www.linuxquestions.com. The user just enter these 2 website. Other websites will be blocked.
How can I do this? Or is there any program for this?

smoker 04-13-2010 07:40 AM

You can't do it in /etc/hosts unless you add a line for every site you want to block
Code:

127.0.0.1          www.website.com
127.0.0.1          www.website2.com
127.0.0.1          www.website3.com

Look at squid proxy instead.

rob33n 04-13-2010 08:16 AM

But I don't want to block all websites. I just have give access max 10-15 websites. These websites can accessible. Other will be blocked.

Dutch Master 04-13-2010 08:30 AM

You may want to look at iptables. This is the actual filter that blocks or allows a website and you can write rules for it that allows certain websites to connect while blocking others. However, it's not recommended for novices! I'm not sure it could handle external whitelists (a file specifically naming allowed websites) though...

smoker 04-13-2010 08:47 AM

Quote:

Originally Posted by rob33n (Post 3934024)
But I don't want to block all websites. I just have give access max 10-15 websites. These websites can accessible. Other will be blocked.

What did I say ?
You can't allow access with /ect/hosts you can only block.
Which means blocking every web site except the ones you want to keep. So you do want to block all web sites, EXCEPT the ones you want to keep.

rob33n 04-14-2010 02:00 AM

Yes I know I can't do this in /etc/host. I just want some advice.
Can I do this with Dansguard? Or is it necessary?

Woodsman 04-14-2010 02:23 PM

Merhaba,

If you are interested in blocking access to various web sites, then consider using a second hosts file with dnsmasq. That is what I use to block many sites. This is a simple and straightforward black list approach. You can start with a healthy block list here. Save that file as /etc/hosts-adservers. Then configure dnsmasq to use that second hosts file. There is no content filtering with this solution --- just plain and simple IP address blocking.

If you are interested in restricting access only to specific web sites --- a white list approach, then you'll have to use some kind of filtering through iptables, squid, dansgaurdian, or something similar. If you use dansguardian you do not have to use squid. You can use something like TinyProxy. Dansguardinan only needs a transparent proxy and that does not always mean the complicated squid.

Using dnsmasq or a transparent proxy does not require any configuration changes to your web browser.


All times are GMT -5. The time now is 04:14 AM.