Wednesday, October 16, 2013

NIS & NSS

This post isn't intended to fully describe the Name Service Switch (NSS) database, traditional managed by directly editing the /etc/nsswitch.conf regular file system file. In Solaris 11, things have changed and moved into SMF services, which is the case here. Nowadays, any direct changes to the aforementioned file will eventually get overridden. Instead, the changes must be carried out on the SMF database.

To adjust the name service switch SMF service according to NIS:

# svccfg -s name-service/switch
...> listprop config/*

...
config/default             astring     files
config/printer             astring     "user files"


...> setprop config/default = astring: "files nis" 
...> setprop config/netgroup = astring: "nis"
...> listprop config/*
...
config/printer             astring     "user files"
config/default             astring     "files nis"

config/netgroup            astring     "nis"

...> select default
...> refresh
...> exit
 
Verify that /etc/nsswitch.conf got updated accordingly.
If not, then try forcing an explicit update before checking again:

# nscfg export name-service/switch


NOTE
The Solaris 11 SMF implementation of the name service switch can be found at Databases and Sources for the Name Service Switch but be aware of a few idiosyncrasies regarding the database names used by the deprecated /etc/nsswitch.conf and svc:/system/name-services/switch:default:
passwd     -> password
bootparams -> bootparam
In case of misspellings the default source will be files.
 
NOTE
Note that /etc/user_attr doesn't have a parallel.
It's because it now follows /etc/passwd according to user_attr(4).


NOTE
To prevent system hangs due to networking issues or even DoS attacks, files should always be the first database source.
 
As additional information, it may be good to recall the implicit default search criteria (the details are present on nsswitch.conf(4)) along a database source list, which may be overridden at each source by suffixing the syntax [STATUS=action]:

SUCCESS=return
UNAVAIL=continue
NOTFOUND=continue
TRYAGAIN=forever
(or 3 if NIS is forwarding to DNS)