LinuxQuestions.org
Help answer threads with 0 replies.
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 06-30-2005, 05:06 AM   #1
supernode
LQ Newbie
 
Registered: Jun 2005
Posts: 3

Rep: Reputation: 0
NFS security with /etc/hosts.deny


Dear all,

I am currently building a supernode including one server and eight clients.

I used RedHat 9.0 on my server and the nfs version is here:

redhat-config-nfs-1.0.4-5
nfs-utils-1.0.1-2.9

I want to safe my system in using NFS by configuring the two following files:
1) /etc/hosts.allow

portmap:ALL

2) /etc/hosts.deny

portmap:ALL
lockd:ALL
mountd:ALL
rquotad:ALL
statd:ALL

I think that with this configuration there will be no client host that can mount to my server.However, any of these eight clients hosts can mount to my server (the mount command is always successful).This means that there is no security with the server, and the remote client is still allowed to contact with the mountd daemon while the mountd daemon is denied from ALL in the latter file. I don't know why so.
If anyone knows the reason please answer me.

Thanks very much
 
Old 06-30-2005, 10:04 PM   #2
synaptical
Senior Member
 
Registered: Jun 2003
Distribution: Mint 13/15, CentOS 6.4
Posts: 2,020

Rep: Reputation: 48
afaik portmap:ALL (and the other services:ALL) goes only in hosts.deny, or else everyone is allowed access.

the client entries in hosts.allow should look something like this example:

Code:
portmap: 192.168.0.100 , 192.168.0.101
lockd:  192.168.0.100 , 192.168.0.101
rquotad: 192.168.0.100 , 192.168.0.101
mountd: 192.168.0.100 , 192.168.0.101
statd:  192.168.0.100 , 192.168.0.101
gl

Last edited by synaptical; 06-30-2005 at 11:11 PM.
 
Old 06-30-2005, 10:46 PM   #3
supernode
LQ Newbie
 
Registered: Jun 2005
Posts: 3

Original Poster
Rep: Reputation: 0
Hi synaptical,
Thanks for your reply,

Infact, I didn' t have any problem with NFS.

The problem I can' t understand here is why the mount command from the client to the server is still successful whereas the /etc/hosts.deny file in the server is configured to ban all access to the mountd daemon on the server.

With the configuration of this /etc/hosts.deny file, all I hope is that when the client mount to the server, it will receive an UNsuccessful message from the server.

Now i always receive the successful message from the server when the mount command is done from the client. I don' t know why.

Hope I can receive your reply soon.
Thanks.
 
Old 06-30-2005, 11:10 PM   #4
synaptical
Senior Member
 
Registered: Jun 2003
Distribution: Mint 13/15, CentOS 6.4
Posts: 2,020

Rep: Reputation: 48
my guess would be because you are allowing "ALL" access to the portmapper, which perhaps is then calling the other daemons. (?)

also, i think i misspoke above. not having clients specified shouldn't allow access if you have the daemons denied in hosts.deny -- i'll edit that out in case it caused any confusion, apologies.

so try that (removing portmap:ALL from hosts.allow), and post back.


p.s. in case it helps clarify, the hosts.allow is read first. if the client is in there, access is allowed. if the client is not in there, hosts.deny is read to see if the client is explicitly blocked. if it's not, it gets access. so that's why i say my guess is that the portmap:ALL in hosts.allow is granting access, and then hosts.deny is not even read.

Last edited by synaptical; 06-30-2005 at 11:16 PM.
 
Old 07-01-2005, 01:28 AM   #5
supernode
LQ Newbie
 
Registered: Jun 2005
Posts: 3

Original Poster
Rep: Reputation: 0
Hi synaptical,

I think that portmapper just provides the port number of the mountd daemon on the server to the client, so the client will access the mountd daemon via this port number. At this point, when the client access the mountd daemon via the port number, it will be banned because of /etc/hosts.deny file. But it is still allowed.

I think it may be due to other causes.,
but i don't know which cause?

Thanks for your reply.
 
Old 07-01-2005, 09:05 AM   #6
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 269Reputation: 269Reputation: 269
You do realize that the allowed hosts are specified in the /etc/exports file for NFS so I don't see the need to deny hosts by your /etc/hosts.deny file or allowing them with the allow file as you can do all of this simply with your exports file to determine who can mount what.
 
Old 07-01-2005, 09:46 AM   #7
synaptical
Senior Member
 
Registered: Jun 2003
Distribution: Mint 13/15, CentOS 6.4
Posts: 2,020

Rep: Reputation: 48
Quote:
Originally posted by supernode
Hi synaptical,

I think that portmapper just provides the port number of the mountd daemon on the server to the client, so the client will access the mountd daemon via this port number. At this point, when the client access the mountd daemon via the port number, it will be banned because of /etc/hosts.deny file. But it is still allowed.

I think it may be due to other causes.,
but i don't know which cause?

Thanks for your reply.
i am not sure that is entirely true, as you are missing the point that the mount is being allowed somewhere before the system is even reading your deny file, most likely in the exportfs, as trickykid said.

but if even that isn't case, instead of asking for a theoretical reason, imo you should just start experimenting until you find out the variable that is allowing it.

man exports
NFS howto

might help

gl

Last edited by synaptical; 07-01-2005 at 09:47 AM.
 
Old 10-21-2005, 11:21 AM   #8
Stéphane Ascoët
Member
 
Registered: Feb 2004
Location: Fleury-les-Aubrais, 120 km south of Paris
Distribution: Devuan, Debian, Mandrake, Freeduc (the one I used to work on), Slackware, MacOS X
Posts: 251

Rep: Reputation: 49
Your problem is portmapper

The message "RPC problem" is clear: Your Linux can't talk to the OS X portmapper.
 
Old 10-22-2005, 09:51 AM   #9
ravee
Member
 
Registered: Jan 2005
Location: India
Distribution: Fedora Core 2
Posts: 83

Rep: Reputation: 15
Quote:
p.s. in case it helps clarify, the hosts.allow is read first. if the client is in there, access is allowed. if the client is not in there, hosts.deny is read to see if the client is explicitly blocked. if it's not, it gets access. so that's why i say my guess is that the portmap:ALL in hosts.allow is granting access, and then hosts.deny is not even read.
Yes you are right. tcpwrappers first checks the hosts.allow file. If a rule matches, then the service is allowed. So the right thing to do is to remove that ofending line from the hosts.allow file.

You might try this rule in the hosts.allow file:

portmap:ALL EXCEPT .yourdomain.com :deny

where yourdomain.com is the domain/IP address of your internal LAN. If you are using the IP address just the network portion of the address will do with a leading dot (.) .

eg:
portmap:ALL EXCEPT 192.168.2. :deny

You can find a nice article about this topic at
http://linuxhelp.blogspot.com/2005/1...ure-linux.html
 
  


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
hosts.allow & hosts.deny question... jonc Linux - Security 9 03-05-2005 09:41 PM
Adding shell commands to hosts.deny and hosts.allow ridertech Linux - Security 3 12-29-2003 03:52 PM
hosts.deny help/how-to jon_k Linux - Software 1 07-25-2003 10:17 PM
hosts.deny and hosts.allow defaults? gui10 Linux - Security 5 12-20-2001 01:57 AM
How to use hosts -.allow and -.deny? dragonflyer Linux - Newbie 2 05-28-2001 08:05 PM

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

All times are GMT -5. The time now is 12:24 AM.

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