Wednesday, October 10, 2007

NIS - Client and Server Configuration


Network Information Service (NIS) is the traditional directory service on *nix platforms. The setup of NIS is relatively simple when compared to other directory services like LDAP. NIS stores administrative files like /etc/passwd, /etc/hosts and so on in Berkeley DB files. This data is made available over the network to all the clients that are connected to the NIS domain.

Drawback : The network connection is not encrypted and all transactions - including passwords - are sent in clear text.

Configuring an NIS Server
  • Make sure the following packages are installed in your machine:
    ypserv : Contains the NIS server daemon (ypserv) and the NIS password daemon (yppasswdd).
    portmap : mandatory
    The yppasswdd daemon enables the NIS server to change the NIS database and password database information, at the client's request. In order to change your NIS password, the yppasswdd daemon must be running on the master server. From the client, one must use yppasswd to update a password within the NIS domain.

  • Insert the following line in the /etc/sysconfig/network file:
    NISDOMAIN=mynisdomain

  • Specify the networks you wish NIS to recognize in /var/yp/securenets .
    Eg:
    # Permit access to localhost:
    host 127.0.0.1

    #Permit access to xyz.com network:
    255.255.255.0 192.168.0.0

  • Insert the following lines in the /var/yp/Makefile :
    NOPUSH=true # Only if you have only a master NIS server else if you have even one slave server, set it to false
    MERGE_GROUP=false # If you have any group passwords in /etc/gshadow that need to be merged into the NIS group map, set it to true.
    MERGE_PASSWD=false # Set to true if you want to merge encrypted passwords from /etc/shadow into the NIS passwd map.

    Uncomment the following line :
    all: passwd group hosts netid ...

  • If you have slave NIS servers then enter their names in /var/yp/ypservers .

  • Finally run the following command:
    # /usr/lib/yp/ypinit -m
Configuring a slave NIS server
  • Install ypserv package on the slave server.
  • Make sure you have the name of the slave server listed in /var/yp/ypservers on the master server.
  • Now issue the command :
    # /usr/lib/yp/ypinit -s masterserver
  • Make sure the NOPUSH value in the /var/yp/Makefile on the master server is set to "false". Then when the master server's databases are updated, a call to the yppush executable will be made. yppush is responsible for transferring the updated contents from the master to the slaves. Only transfers within the same domain are made with yppush.
  • Lastly start ypserv and yppasswdd daemons
    # service ypserv start
    # service yppasswdd start
Configuring an NIS client
  • Make sure the following packages are installed on your machine:
    ypbind - NIS client daemon
    authconfig - used for automatic configuration of NIS client.
    yp-tools: Contains utilities like ypcat, yppasswd, ypwhich and so on used for viewing and modifying the user account details within the NIS server.
    portmap (mandatory)
  • There are two methods to configure an NIS client.
    • Method 1: Manual method
      • Enter the following line in the /etc/sysconfig/network file:
        NISDOMAIN=mynisdomain
      • Append the following line in /etc/yp.conf :
        domain mynisdomain server 192.168.0.1 # replace this with your NIS server address.
      • Make sure the following lines contain 'nis' as an option in the file /etc/nsswitch.conf file:
        passwd: files nis
        shadow: files nis
        group: files nis
        hosts: files nis dns
        networks: files nis
        protocols: files nis
        publickey: nisplus
        automount: files nis
        netgroup: files nis
        aliases: files nisplus
      • Finally restart ypbind and portmap.
    • Method 2: Run authconfig and follow directions.
  • To check if you have succesfully configured NIS client, execute the following :
    # ypcat passwd
    The output will be the contents of the /etc/passwd file residing on the NIS server having user IDs greater than or equal to 500.

No comments: