Home Linux & Systems Cybersecurity Cloud & DevOps Networks & Infrastructure SIEM & Monitoring DFIR & Threat Intel Development & Other All categories Projects About Tools

Install NIS Master Server on Solaris 10

Leer en espanol
Install NIS Master Server on Solaris 10

Table of contents

NIS (Network Information Service) ands the name of a protocol directory servicesclient-server developed by Sun Microsystems for sending configuration data in distributed systems such as usernames and hosts between computers over a network.

NIS está basado en ONC RPC, and consists of a server, a client-side library, and various administration tools.

Sol10logo

First we verify that we have all these files and we create the ones that are not there.

text
/etc/auto_home                                        (Esta creado)
text
/etc/auto_master                                      (Esta creado)
text
/etc/bootparams                                       (Hay que crearlo)
text
/etc/ethers                                                (Esta creado)
text
/etc/group                                                (Esta creado)
text
/etc/hosts                                                 (Esta creado)
text
/etc/inet/ipnodes                                    (Esta creado)
text
/etc/mail/aliases                                      (Esta creado)
text
/etc/netgroup                                          (Hay que crearlo)
text
/etc/netid                                                (Hay que crearlo)
text
/etc/netmasks                                         (Esta creado)
text
/etc/networks                                         (Esta creado)
text
/etc/passwd                                            (Esta creado)
text
/etc/protocols                                         (Esta creado)
text
/etc/publickey                                        (Esta creado)
text
/etc/rpc should                                      (Esta creado)
text
/etc/services                                          (Esta creado)
text
/etc/shadow                                         (Esta creado)
text
/etc/timezone                                       (Hay que crearlo)
text
/etc/auth_attr                                       (Copiar fichero de: /etc/security/)
text
/etc/exec_attr                                       (Copiar fichero de: /etc/security/exec_attr  )
text
/etc/prof_attr                                       (Copiar fichero de: /etc/security/prof_attr )
text
/etc/audit_user                                    (Copiar fichero de: /etc/security/audit_user   )

In order not to lose any type of configuration or important file, we make a backup copy of the file.

nsswitch.conf

Bash
cp /etc/nsswitch.conf /etc/nsswitch.conf.old

We copy the configuration from the file nsswitch.nis to nsswitch.conf

Bash
cp /etc/nsswitch.nis /etc/nsswitch.conf

Within the file we have to modify some lines.

we change

text
hosts: nis [NOTFOUND=return] files

by

text
hosts: files nis dns

and we also change this parameter

text
automount: files nis

by

text
automount: nis files

Next we create the structure where we are going to export the configuration files of the nis server users.

Bash
mkdir -p /etc/nis/etc/security

within /etc/nis/etc/ we copy the files: passwd and shadow

Bash
cp /etc/passwd /etc/nis/etc/
Bash
cp /etc/shadow /etc/nis/etc/

We edit the file /etc/nis/etc/passwd and we delete all users from the system (root,daemon,bin,sys,adm,lp,uucp,nuucp,smmsp,listen,gdm,webservd,nobody,noaccess,nobody4)

text
cd /etc/nis/etc
Bash
vi passwd

Edit each user entry, removing the password placeholder (“x” in the second field) and replacing it with two hashes and the username. Example:

text
operador:##operador:100:1::/export/home/operador:bin/bash

So as not to do it one by one...

we make a copy

cp passwd passwd.orig

and we edit the file with an awk

text
nawk -F “:”  ’{printf “% s: # #% s:% s:% s:% s:% s:% s \ n “, $ 1, $ 1, $ 3, $ 4, $ 5, $ 6, $ 7}’  passwd.orig > passwd

We generate the file passwd.adjunct

text
nawk -F  ”:”  ’{printf “% s:% s ::::: \ n”, $ 1, $ 2}’  passwd.orig > security/passwd.adjunct

We modify the file Makefile.

text
cd /var/yp
Bash
vi Makefile

We look for the following line and change it:

text
PWDIR  = /etc

by

text
PWDIR  = /etc/nis/etc

We also modify the following line:

CODE
Bash
c2secure:
        -@if [ -f $(PWDIR)/security/passwd.adjunct ]; then \
                if [ ! $(NOPUSH) ]; then $(MAKE) $(MFLAGS) -k \
               passwd.adjunct.time group.adjunct.time; \
                else $(MAKE) $(MFLAGS) -k NOPUSH=$(NOPUSH) \
                passwd.adjunct.time group.adjunct.time; \

                fi; \
        fi

by

CODE
Bash
c2secure:
        -@if [ -f $(PWDIR)/security/passwd.adjunct ]; then \
                if [ ! $(NOPUSH) ]; then $(MAKE) $(MFLAGS) -k \
                passwd.adjunct.time; \
                else $(MAKE) $(MFLAGS) -k NOPUSH=$(NOPUSH) \
               passwd.adjunct.time; \
                fi; \
        fi

We also delete all the users that are not necessary in the file /etc/nis/etc/shadow

(root,daemon,bin,sys,adm,lp,uucp,nuucp,smmsp,listen,gdm,webservd,nobody,noaccess,nobody4)

We add a domain name

text
domainame red-orbita.es

we make it permanent

text
domainname > /etc/defaultdomain

We promote as master server.

text
/usr/sbin/ypinit -m

It will ask us for the name of the server and check all the files and configuration in case there are any errors.

To check that everything is correct, just enter:

text
ypwhich

and if we want to see the users

text
ycat passwd

Greetings, rokitoh!

Comments