NIS has inherent security and fault tolerant issues. By using the follwoing method to secure NIS you also make it fault tolerant, there is a downside but this is discussed at the end.
First read the man page for the securenets file. Then place the file in the /var/yp directory on your NIS master and do not allow any machines to retrieve NIS information from the master.
Then set each NIS client to be a NIS secondary, and in the /var/yp/securenets file only allow each machine to retrieve NIS information from itself.
This means that:
1) No machine outside of your defined NIS primaries and secondaries will be able to retrieve any NIS information. 2) All NIS information will now be retreived via the loopback interface, which is almost as fast as using the local files. 3) No machine will be dependent on any other for NIS information.
The downside to this approach is obviously that it requires a lot more bandwidth to push out the NIS maps. However I have found that this approach scales well to a couple of thousand hosts, after this point you can follow approaches such as limiting pushing the maps out to once a day out of hours, etc.
PLEASE NOTE: NIS is inherently insecure and provides little authentication over and above IP address, if you require truly secure Directory Services you should investigate either NIS+ or LDAP over SSL.
This was first published in May 2001