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.
|
 |
01-05-2007, 03:32 PM
|
#1
|
Member
Registered: Dec 2006
Location: Bristol, England
Distribution: Fedora Core 6
Posts: 77
Rep:
|
How To Block Websites? Maybe /etc/hosts (.deny maybe) How?
How do I block websites, I am using Fedora Core 6, using Firefox 2, in Windows I know that a /etc/hosts files in system32 controls which sites are allowed or blocked by searching google. In Linux I found some host files in /etc directory. How do I use it or block sites another way?
|
|
|
01-05-2007, 03:37 PM
|
#2
|
Senior Member
Registered: Apr 2005
Location: OZ
Distribution: Debian Sid/RPIOS
Posts: 4,916
|
The /etc/hosts works the same as the HOSTS file in windows, just add the sites you want blocked:
127.0.0.1 example.com
Of course you could also use dansguardian and squid to do the same thing, but that takes a little more to set up.
|
|
|
01-05-2007, 05:37 PM
|
#3
|
Member
Registered: Dec 2006
Location: Bristol, England
Distribution: Fedora Core 6
Posts: 77
Original Poster
Rep:
|
Every example I see has an IP then a website, is the IP needed, is it the websites server IP or is it the Networks IP.. the Network that isn't allowed to access the site?
Just to make the question simpler.. Do I need an IP and who's IP is it. If it is the websites and needed, no problem.
|
|
|
01-05-2007, 06:25 PM
|
#4
|
Senior Member
Registered: Apr 2005
Location: OZ
Distribution: Debian Sid/RPIOS
Posts: 4,916
|
Example/part of my /etc/hosts file:
127.0.0.1 localhost.localdomain localhost
# This MVPS HOSTS file is a free download from: #
# http://www.mvps.org/winhelp2002/ #
#start of lines added by WinHelp2002
# [Misc A - Z]
127.0.0.1 ad.a8.net
127.0.0.1 asy.a8ww.net
127.0.0.1 www.abcsearcher.com #[Spamdexing][Microsoft.Strider]
127.0.0.1 www.acezip.net #[Win32/Adware.180Solutions]
127.0.0.1 adserver.adbunker.com
127.0.0.1 phpadsnew.abac.com
The hosts file in Linux (/etc/hosts) is a simple list of IP addresses and the hostnames that they correspond to. Every hosts file in Linux should have an entry for the IP address "127.0.0.1", with the name "localhost" following it. This is also known as the loopback address. That same file may also have an entry for your system name, unless you did not provide one during installation.
Last edited by craigevil; 01-05-2007 at 06:32 PM.
|
|
|
01-06-2007, 07:15 AM
|
#5
|
Member
Registered: Dec 2006
Location: Bristol, England
Distribution: Fedora Core 6
Posts: 77
Original Poster
Rep:
|
ok, so the IP is the same every time and is the localhost IP. Basically I just use the IP from this line 127.0.0.1 localhost.localdomain localhost and add the sites after.. is it possible to block something like *.*porn*.* instead of each individual www.crapornsiteinthe.net
|
|
|
01-06-2007, 07:49 AM
|
#6
|
Member
Registered: Aug 2004
Location: India
Distribution: Redhat 9.0,FC3,FC5,FC10
Posts: 257
Rep:
|
You'll have to use Squid I believe.
|
|
|
01-06-2007, 02:14 PM
|
#7
|
Senior Member
Registered: Nov 2004
Location: Texas
Distribution: RHEL, Scientific Linux, Debian, Fedora
Posts: 3,935
Rep: 
|
/etc/hosts entries (or iptables OUTPUT chain rules) are a nice and quick solution for blocking just a few hosts.
Blocking something like requires more flexibility, and I'll agree with the solution that was already suggested several times: squid. It's well documented and lots of folks use it.
|
|
|
01-08-2007, 04:58 PM
|
#8
|
Member
Registered: Dec 2006
Location: Bristol, England
Distribution: Fedora Core 6
Posts: 77
Original Poster
Rep:
|
Well my hosts file is working OK.
I don't know how to use Squid, is it an external program.. because I cannot find a way to open it. If it is a part of SELinux then I don't know how to edit it for certain bans.
Also could I get it to ban say.. the word porn but still allow anti-porn...say?
|
|
|
All times are GMT -5. The time now is 11:14 AM.
|
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
|
|