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? |
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 |
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.
|
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...
|
Quote:
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. |
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? |
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. |