Fedora Linux Support Community & Resources Center

Go Back   FedoraForum.org > Fedora 17/18 > Servers & Networking
FedoraForum Search

Forgot Password? Join Us!

Servers & Networking Discuss any Fedora server problems and Networking issues such as dhcp, IP numbers, wlan, modems, etc.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 15th February 2006, 03:15 PM
nade Offline
Registered User
 
Join Date: Jul 2004
Location: UK
Posts: 19
Using /etc/hosts.deny to block remote machine (Core4)

Hi,

I've tried to drop myself in the deep end back into Fedora. I've used FC3 in the past and setup as a DHCP server with success

But now i'm having a go at setting up a DNS server using bind.

What i'm trying to do at the moment is block any access from a specific hostname/ip by adding it in the /etc/hosts.deny file.

I've used the ip like this "10.10.200.1.deny" and restarted the network services which didn't work. I then tried using "srv-0220.deny" in the file and that didn't work either. So i then tried using the full dns name for the server with .deny on the end and that didn't work either.

Anyone able to point me in the right direction?

Thanks for reading.

EDIT: Oh forgot to mention. As the machine i am trying to build is within a private corporate network i didn't bother enabling the firewall when i did the original install of FC4. I didn't even bother installing gnome/kde, just using the cli.

Last edited by nade; 15th February 2006 at 03:19 PM.
Reply With Quote
  #2  
Old 15th February 2006, 03:18 PM
hiberphoptik's Avatar
hiberphoptik Offline
Registered User
 
Join Date: Apr 2004
Posts: 1,186
the syntax would be 10.0.0.1:deny

really the proper way to do it would be to add ALL:deny to /etc/hosts.deny and then edit /etc/hosts.allow to allow 10.0.0.1 to a service
Reply With Quote
  #3  
Old 15th February 2006, 03:21 PM
nade Offline
Registered User
 
Join Date: Jul 2004
Location: UK
Posts: 19
Quote:
Originally Posted by hiberphoptik
the syntax would be 10.0.0.1:deny

really the proper way to do it would be to add ALL:deny to /etc/hosts.deny and then edit /etc/hosts.allow to allow 10.0.0.1 to a service
Ah ok. Thanks for quick reply!

I'll give it a shot.
Reply With Quote
  #4  
Old 15th February 2006, 03:26 PM
Zigzagcom Offline
Registered User
 
Join Date: Feb 2005
Location: CALIFORNIA, yeah
Age: 86
Posts: 1,657
The /etc/hosts.allow and /etc/hosts.deny files work in tandem.

I have only used them to filter sshd traffic to my machine.

Mine looks like this:
Code:
/etc/hosts.deny
sshd : ALL
Code:
/etc/hosts.allow
sshd : 127.0.0.1   192.168.1.0/24   xxx.xxx.xxx.xxx/xx
In your case you want to reverse the order possibly

Code:
/etc/hosts.allow
service : ALL
Code:
/etc/hosts.deny
service : xxx.xxx.xxx.xxx./xx
but I am not sure if it works for all services.
__________________
Ziggy
Reply With Quote
  #5  
Old 15th February 2006, 03:29 PM
nade Offline
Registered User
 
Join Date: Jul 2004
Location: UK
Posts: 19
Is there a service i need to restart after modifying the .deny and .allow host files?
Reply With Quote
  #6  
Old 15th February 2006, 03:43 PM
nade Offline
Registered User
 
Join Date: Jul 2004
Location: UK
Posts: 19
Quote:
Originally Posted by Zigzagcom
Code:
/etc/hosts.allow
sshd : 127.0.0.1   192.168.1.0/24   xxx.xxx.xxx.xxx/xx
That's exactly what i'm after. Just trying to secure it from anyone else trying to ssh onto the machine

But please forgive my newbie-ness but i'm guessing the part you have as xxx.xxx.xxx.xxx/xx will be the subnet mask? And the 192 address is your own PC that's connecting to the linux machine?
Reply With Quote
  #7  
Old 15th February 2006, 03:54 PM
Zigzagcom Offline
Registered User
 
Join Date: Feb 2005
Location: CALIFORNIA, yeah
Age: 86
Posts: 1,657
Almost correct,
xxx.xxx.xxx.xxx / xxCIDR notation.
Example: 192.168.1.100 is specific, but 192.168.0.0/16 is a block. (OOPS)
I am allowing connections on the loopback, the LAN, and then select IP's that could be in the form
of a defined IP or a subnet. For instance, I have DSL where the IP address might change ( it's fairly constant, but yet it's DHCP), so I set a network block on the remote server I administer, that is large enough to cover the pool of IP's from my local box.
It is not a guarantee, 'cause the ISP might decide to assign a new IP from a totally different pool, but then I have a backdoor via Webmin. ( Or its a twenty mile ride out to the server).

P.S. I try to refrain from using DNS names, cause they can be easily spoofed.
__________________
Ziggy

Last edited by Zigzagcom; 15th February 2006 at 04:01 PM.
Reply With Quote
  #8  
Old 15th February 2006, 04:00 PM
nade Offline
Registered User
 
Join Date: Jul 2004
Location: UK
Posts: 19
OK, Cool

Think i've got it sussed.... i've got this working:
Code:
/etc/hosts.deny
sshd : ALL
Code:
/etc/hosts.allow
sshd : 10.10.201.
I've tried putty on a windows server on the 10.10.200.0 subnet and it ain't getting in, but my laptop on the 10.10.201.0 subnet is fine

I can't imagine the amount of crap i'd had to install on a windows server to do something as simple as this! I'm liking linux/fedora more and more.

Thanks Zigzagcom and hiberphoptik for the help
Reply With Quote
  #9  
Old 15th February 2006, 04:03 PM
Zigzagcom Offline
Registered User
 
Join Date: Feb 2005
Location: CALIFORNIA, yeah
Age: 86
Posts: 1,657
Cool, nice to see you happy....

The way you have it set up works, because you are defining the network blocks on the byte boundary. If you were to shift some of the host bits around, use CIDR notation then.
__________________
Ziggy

Last edited by Zigzagcom; 15th February 2006 at 04:09 PM.
Reply With Quote
Reply

Tags
block, core4, machine, or etc or hostsdeny, remote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
how to hosts.allow and host.deny fc6 FCL_user EOL (End Of Life) Versions 10 14th November 2010 09:19 PM
how to configure hosts.allow and hosts.deny nkjha Security and Privacy 4 19th January 2009 03:10 PM
hosts.deny vs iptables cbrenchley Using Fedora 3 15th April 2008 12:38 AM
Using /etc/hosts.deny to block one IP simply capnqwest Security and Privacy 5 31st January 2005 06:13 AM


Current GMT-time: 22:36 (Thursday, 23-05-2013)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat