LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices

Reply
 
Search this Thread
Old 03-09-2009, 01:43 AM   #1
prashant.saraf
Member
 
Registered: Mar 2009
Location: Hartford US
Distribution: Ubuntu and Fedora
Posts: 35

Rep: Reputation: 0
Block Sites


Hi,

In windows we have a file called HOST(%windows%drivers/etc), we can block/redirect sites to desire location, Can I do same thing in my Fedora 10?


Thanks
Prashant Saraf
 
Old 03-09-2009, 02:34 AM   #2
SkyEye
Member
 
Registered: Sep 2005
Location: Sri Lanka
Distribution: Fedora (workstations), CentOS (servers), Arch, Mint, Ubuntu, and a few more.
Posts: 441

Rep: Reputation: 40
Quote:
Originally Posted by prashant.saraf View Post
Hi,

In windows we have a file called HOST(%windows%drivers/etc), we can block/redirect sites to desire location, Can I do same thing in my Fedora 10?


Thanks
Prashant Saraf
Hi and Welcome to LQ!

Secondly, in short answer to your question: Yes.

Thirdly, it can be done in any Linux system (not only Fedora) using different approaches. It's not a Windows feature BTW. If you see you notice that /etc part in the file path of the Windows system tries to emulate the Unix file system hierarchies.

Anyway you can do what you desire. There is a /etc/hosts file where you can do what you did in the Windows system.

Another way of doing that is by using the TCP Wrappers system. This is how you do it. You can use hosts.allow and hosts.deny file in /etc to allow or deny connections. See 'man 5 hosts_options' and 'man 5 hosts_access'for more information on rule syntax.

There are other techniques too, but I guess these might be sufficient and simple.
 
Old 03-09-2009, 03:12 AM   #3
prashant.saraf
Member
 
Registered: Mar 2009
Location: Hartford US
Distribution: Ubuntu and Fedora
Posts: 35

Original Poster
Rep: Reputation: 0
Hi Thanks for warm welcome,
it's great to know that etc is not windows feature. thanks for quick reply.
 
Old 03-09-2009, 10:36 AM   #4
rweaver
Senior Member
 
Registered: Dec 2008
Location: Louisville, OH
Distribution: Debian, CentOS, Slackware, RHEL, Gentoo
Posts: 1,833

Rep: Reputation: 163Reputation: 163
Quote:
Originally Posted by prashant.saraf View Post
Hi,

In windows we have a file called HOST(%windows%drivers/etc), we can block/redirect sites to desire location, Can I do same thing in my Fedora 10?


Thanks
Prashant Saraf
You can block it that way (/etc/hosts), however a better way would be to use iptables.

a simple way to block traffic to and from would be:

iptables -A INPUT -s sitetoblock.com -j DROP
iptables -A OUTPUT -d sitetoblock.com -j DROP

Although if you only want to block going to the site the second will do it alone. Having it in conjunction with the first makes it a bit stronger however.
 
Old 03-11-2009, 03:21 PM   #5
T74marcell
Member
 
Registered: Mar 2009
Posts: 102

Rep: Reputation: 18
The file /etc/hosts.deny is specifically meant to contain the list of IP's that are not allowed to access the server at all. There is also an /etc/hosts.allow file with the obvious opposite function.

Arch Linux

Last edited by T74marcell; 03-14-2009 at 01:11 AM.
 
  


Reply

Tags
hosts, hostsallow, hostsdeny, tcpwrappers


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Squid to block all the sites except 1 or 2 sites winxandlinx Linux - Networking 8 10-27-2010 02:53 AM
squid 2.6 not blocking sites even i entered ACL to block sites mohantorvalds Linux - Server 1 01-08-2009 04:17 AM
how to block sites 4ajaysingh Linux - Networking 1 01-23-2007 09:01 AM
Squid block sites linuxnirmal Linux - Security 5 11-15-2006 10:59 AM
block some sites nkutty Linux - Security 1 10-03-2005 04:15 AM


All times are GMT -5. The time now is 07:54 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration