LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 12-06-2009, 03:20 AM   #1
vivaviva
LQ Newbie
 
Registered: Dec 2009
Posts: 7

Rep: Reputation: 0
access security to services NFS


Hi,

For reason of access security, to authorize only one machine customer chosen to reach services NFS by using the files hosts.deny and hosts.allow.

I do not find which line to be added in the file hosts.deny and/or hosts.allow?

Thinks.
 
Old 12-06-2009, 06:40 AM   #2
camorri
LQ 5k Club
 
Registered: Nov 2002
Location: Somewhere inside 9.9 million sq. km. Canada
Distribution: Slackware 15.0, current, slackware-arm-currnet
Posts: 6,246

Rep: Reputation: 861Reputation: 861Reputation: 861Reputation: 861Reputation: 861Reputation: 861Reputation: 861
To deny everything, add these lines to /etc/hosts.deny

Quote:
cat /etc/hosts.deny
portmap:ALL
lockd:ALL
mountd:ALL
rquotad:ALL
statd:ALL
ALL:ALL
This blocks all access, including services like ssh. Now to allow what you want through, edit /etc/hosts.allow, and add the things you want through. It will look like this:

Quote:
portmap: 192.168.1.20 , 192.168.1.21 ,

lockd: 192.168.1.20 , 192.168.1.21 ,
rquotad: 192.168.1.20 , 192.168.1.21 ,
mountd: 192.168.1.20 , 192.168.1.21 ,
statd: 192.168.1.20 , 192.168.1.21 ,
sshd sshd1 sshd2 : 192.168.1.20 , 192.168.1.21 ,
The allow file is a comma separated list of IP's to allow. I believe the allow file rules are applied first, first match stops processing, and then the deny rules are applied if there are no matches. See the man page for hosts.allow. There are several different ways of specifying IP addresses. I just use a simple list for a small network. I had to add ssh to this file, without it ssh was blocked. Ssh is not required for NFS.

Last edited by camorri; 12-07-2009 at 09:21 AM. Reason: Corrected a comment on allow - deny
 
Old 12-06-2009, 01:23 PM   #3
vivaviva
LQ Newbie
 
Registered: Dec 2009
Posts: 7

Original Poster
Rep: Reputation: 0
$ rpcinfo -p

The result of this command is :

Quote:
program no_version protocole no_port
100000 2 tcp 111 portmapper
100000 2 udp 111 portmapper
100024 1 udp 46082 status
100024 1 tcp 55450 status
100003 2 udp 2049 nfs
100003 3 udp 2049 nfs
100003 4 udp 2049 nfs
100021 1 udp 48126 nlockmgr
100021 3 udp 48126 nlockmgr
100021 4 udp 48126 nlockmgr
100003 2 tcp 2049 nfs
100003 3 tcp 2049 nfs
100003 4 tcp 2049 nfs
100021 1 tcp 59252 nlockmgr
100021 3 tcp 59252 nlockmgr
100021 4 tcp 59252 nlockmgr
100005 1 udp 52960 mountd
100005 1 tcp 49589 mountd
100005 2 udp 52960 mountd
100005 2 tcp 49589 mountd
100005 3 udp 52960 mountd
100005 3 tcp 49589 mountd
Is it correct to make this :

/etc/hosts.deny:

Quote:
portmapper:ALL
status:ALL
nlockmgr:ALL
mountd:ALL

/etc/hosts.allow:

Quote:
portmapper:192.168.0.2
status:192.168.0.2
nlockmgr:192.168.0.2
mountd:192.168.0.2
 
Old 12-06-2009, 02:47 PM   #4
camorri
LQ 5k Club
 
Registered: Nov 2002
Location: Somewhere inside 9.9 million sq. km. Canada
Distribution: Slackware 15.0, current, slackware-arm-currnet
Posts: 6,246

Rep: Reputation: 861Reputation: 861Reputation: 861Reputation: 861Reputation: 861Reputation: 861Reputation: 861
As far as I know that is O.K. You may want to do some more testing, and checking. Here is the best reference I have come across.

-->http://www.linuxselfhelp.com/HOWTO/N.../security.html
 
Old 12-06-2009, 10:26 PM   #5
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,369

Rep: Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753
The /etc/hosts.allow file is read first, then /etc/hosts.deny.
Generally, you just want ALL:ALL in hosts.deny for the above.
http://linux.die.net/man/5/hosts.allow
 
1 members found this post helpful.
Old 12-07-2009, 09:23 AM   #6
camorri
LQ 5k Club
 
Registered: Nov 2002
Location: Somewhere inside 9.9 million sq. km. Canada
Distribution: Slackware 15.0, current, slackware-arm-currnet
Posts: 6,246

Rep: Reputation: 861Reputation: 861Reputation: 861Reputation: 861Reputation: 861Reputation: 861Reputation: 861
Chris, thank-you for the correction. I updated my comment on allow deny.
 
Old 12-08-2009, 12:46 AM   #7
vivaviva
LQ Newbie
 
Registered: Dec 2009
Posts: 7

Original Poster
Rep: Reputation: 0
Please, what is the new correction to put in 'hosts.deny' and 'hosts.allow'?

Is my answer above true ?

Thanks.
 
Old 12-08-2009, 01:35 AM   #8
linuxlover.chaitanya
Senior Member
 
Registered: Apr 2008
Location: Gurgaon, India
Distribution: Cent OS 6/7
Posts: 4,631

Rep: Reputation: Disabled
As Chris said, hosts.allow file is read first, so you should be fine with putting ALL:ALL in hosts.deny and then put the services and hosts that you want to allow in hosts.allow.
 
Old 12-08-2009, 01:44 AM   #9
vivaviva
LQ Newbie
 
Registered: Dec 2009
Posts: 7

Original Poster
Rep: Reputation: 0
/etc/hosts.deny:

Quote:
ALL:ALL
/etc/hosts.allow:


Quote:
portmapper:192.168.0.2
status:192.168.0.2
nlockmgr:192.168.0.2
mountd:192.168.0.2
It is that ?

Last edited by vivaviva; 12-08-2009 at 02:04 AM.
 
Old 12-08-2009, 02:47 AM   #10
linuxlover.chaitanya
Senior Member
 
Registered: Apr 2008
Location: Gurgaon, India
Distribution: Cent OS 6/7
Posts: 4,631

Rep: Reputation: Disabled
Yes. That looks absolutely fine to me.
 
  


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
ls: cannot access /etc/resolv.conf: stale nfs file handle - but i'm not using nfs schneidz Linux - General 4 10-02-2009 02:39 PM
NFS and RH Cluster Suite; Problems relating services/resources to NFS l_long_island Linux - Server 5 08-30-2008 11:20 AM
NFS Services Startup Problem woodwarh Linux - Networking 1 12-05-2003 06:21 AM
NFS Services do not start at Boot up nishi_k_79 Linux - Networking 4 10-02-2003 07:18 AM
services(openssh, NFS, syslog) nautilus_1987 Linux - General 10 09-04-2002 06:30 AM

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

All times are GMT -5. The time now is 07:21 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