LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
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 05-01-2012, 10:29 AM   #1
m223464
LQ Newbie
 
Registered: Jul 2007
Posts: 10

Rep: Reputation: 1
/etc/hosts.deny not blocking hosts from using NFS - Centos


Hi,

I've trawled through the forum to see if this topic's been covered but can't find anything.

I'm trying to figure out how you deny particular hosts from mounting NFS mounts. Everything I've read online points to using hosts.deny for this type of security but I can't get it to work.

e.g.
server1 has nfs running with the following configuration, however server2 is still able to mount /data without any issue.

/etc/exports
Code:
/data *(ro)
/etc/hosts.deny
Code:
ALL:ALL
/etc/hosts.allow is empty

This config of hosts.deny is working for protocols such as ssh but not nfs.

Can anyone advise me why this isn't working or the correct method to restrict servers from access to NFS mounts.

thanks

Gareth
 
Old 05-01-2012, 01:55 PM   #2
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
No. You use /etc/exports to say which hosts can mount. The way you have it setup all hosts can currently mount /data as a read only filesystem.

For example you could setup:
/directory 192.168.1.0/22(rw,no_root_squash,insecure) 10.0.4.5(rw,no_root_squash)

That would tell it to allow all hosts in the 192.168.1.0 subnet to mount with the options shown and also allow the host at 10.0.4.5 to mount with the options shown for it. No other host would be able to mount. Usually the list of hosts you want to allow is shorter than the list you don't want.

/etc/hosts.allow and /etc/hosts.deny are used for tcp wrappers and only applications that are tcp wrapper aware can use them.

If you type "man exports" you'll get more information about the structure of /etc/exports.
 
1 members found this post helpful.
Old 05-01-2012, 03:34 PM   #3
m223464
LQ Newbie
 
Registered: Jul 2007
Posts: 10

Original Poster
Rep: Reputation: 1
Thanks for your explanation. I had checked the man page prior to posting but had read in various articles online that hosts.allow/deny and exports were related.
 
Old 05-10-2012, 08:54 PM   #4
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,362

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
As per MensaWater, you start by restricting what is exported to whom in the NFS exports file.

You may(!) want to fine tune that by restricting the portmap daemon via tcp wrappers http://www.linuxtopia.org/online_boo...appers-purpose.

Note that NFSv4 does not use portmap, so if using that, check whether it uses tcp wrappers (ie hosts.allow, hosts.deny) using the technique here http://www.linuxtopia.org/online_boo...d-TCP_Wrappers.

Alternately, there's always iptables ...
 
  


Reply



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
Access denied for NFS - but hosts.allow and hosts.deny seem OK royce2020 Linux - Networking 4 10-17-2011 10:44 PM
Question about NFS and /etc/hosts.{allow,deny} bonixavier Slackware 7 05-20-2011 07:39 PM
can't restrict sshd access through hosts.allow and hosts.deny but was working earlier farhan Linux - Security 4 04-18-2008 07:41 AM
NFS security with /etc/hosts.deny supernode Linux - Security 8 10-22-2005 09:51 AM
deny.hosts does not work in blocking anything lexton Linux - Newbie 4 04-06-2004 08:45 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 04:22 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration