Here is an example implementation of utilizing a netgroup "nfs-clients" for authorization to NFS shares. Very simple and effective in only allowing those servers that you trust to mount up NFS shares from central fileservers. I'm quite sure there is some spoofing methods (including DNS cache poisoning) that could drastically affect the effectiveness of this method, but it's better and leaving an NFS share open to the [internal] world to mount up.
As most of my postings, the context of this setup is Sun Java Directory Server 6.x with Solaris-based LDAP clients performing queries against the directory. Small modifications can make this work on other *nix/LDAP platforms.
- If you don't already have it, create a new OU called ou=netgroup,dc=your,dc=domain.
- Create a new object under this new OU, with objectclasses of: top and nisNetgroup
- Configure the attributes of this nisNetgroup object with similar attributes as below, remembering that the nisNetgroupTriple attribute is multi-valued and will hold an entry for each host (must be listed as FQDNs!!!) that will be allowed to mount NFS shares that specify this netgroup in /etc/dfs/dfstab
nisNetgroupTriple: (nfsclient1.domain.net,,)
nisNetgroupTriple: (nfsclient2.domain.net,,)
objectClass: nisNetgroup
objectClass: top
cn: nfs-clients - Modify the DUA profile that the LDAP clients are configured with to include a ServiceSearchDescriptor such as the following, to ensure that nsswitch looking in the right branch of the directory tree for the netgroup information:
netgroup:ou=netgroup,dc=your,dc=domain?sub
- Now, modify your dfstab entry to specify options for the share(s) to reference netgroups to allow ro/rw access and mapping of the root user:
share -F nfs -o ro=nfs-clients,root=nfs-clients /export/home
- Of course, run the shareall command to reshare this NFS export with the updated options, and it would probably be a good idea to restart nscd (name service cache daemon) as well.
- On your NFS/LDAP clients, make sure that the value for the netgroup lookup is set to LDAP:
# grep netgroup /etc/nsswitch.conf
netgroup: ldap - Mount it up on one of the servers specified in the netgroup, nfs-clients, and attempt to mount it on a server not listed in that netgroup to validate that authorization control is working properly.