From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <96078619210726.tru64-unix-managers.marc@archive.invalid> From: LBRO Date: Thu, 27 Nov 1997 09:56:48 +0000 To: tru64-unix-managers Subject: SUMMARY: NIS on ASE cluster X-MARC-Message: https://marc.info/?l=tru64-unix-managers&m=96078619210726 --simple boundary Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Hi, This applies to all who use ASE, NIS and Enhanced Security. A long time ago, I asked how to implement a highly available NIS master server in an ASE environment. I have now been forced to do this implementation myself and have come up with something that seems to work pretty nice. I attach a description of the solution, comments are very welcome. Normally, the outage of the NIS master only causes the yppasswd command to be unavailable. But with Enhanced Security, people cannot even log in. Users of ASE may want to put the NIS server on the cluster to avoid this situation. Lars Bro (lbro@dscc.dk) --simple boundary Content-Type: text/plain; charset=US-ASCII; name="config." Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="config." The following text discusses how to configure ENHANCED SECURITY, NIS and ASE. My environment consists of a number of clusters that together run a distributed TMN (Telecommunications Management Network) application. The requirements for uptime are high. User management is done with XIsso and XSysAdmin. They support NIS. 1 ASE ASE means Available Server Environment and implements failover on DU. Two or more machines may share a SCSI bus. A service is defined as some processes and mountpoints. A service may be moved between the members of an ASE cluster by moving the mount point. A servise can only be present on one member at a time. A service can be assigned an IP adress. The machine currently running the service adds this IP adress as an alias in its network interface (a machine may have more than one IP adress). 2 NIS and ENHANCED SECURITY In Enhanced Security, a record is kept of each authentication. Enhanced Secutity works together with NIS by having all the information normally stored in /tcb/files moved to the nis map prpasswd for the accounts controlled by NIS. All in all, this means that if the NIS master server becomes unavailable, it is not possible to do log on or off. This is considered a single point of failure even though the users already logged on are able to continue their work. 3 NIS and ASE In a cluster system, everything must be able to continue as normally even if one of the members becomes unavailable. We will have to cluster'ise NIS. 3.1 Cluster adress The NIS server must have a cluster adress so that all clients and all the slave servers can carry on unaffected by a failover. 3.2 Slave servers Although the ASE setup must support slave servers as well as dumb clients, it may still be a matter of taste what to use. Enhanced Security updates NIS every time anybody logs on or off. This makes a lot of updating if there are many slaves. If a host does not run a slave, it will be literally down in case of net outage since everything will hang in NIS (for example ls -l). Minimally, a machine that is a cluster member must also be a slave because cluster members are supposed to be able to act reasonably in case of net outage. 4 Suggestion 4.1 On the cluster 4.1.1 Service Config An ASE disk service is configured as follows: o Mountpoint: /var/yp/src o IP name: tmn_nis The IP name must be added to /etc/hosts of all clients. 4.1.2 Start Script The start script of the ASE service will stop NIS, reconfigure as NIS master, then restart NIS. > /sbin/init.d/nis stop > NIS_DOMAIN=`/usr/sbin/rcmgr get NIS_DOMAIN` > /usr/sbin/rcmgr set NIS_TYPE MASTER > /usr/sbin/rcmgr set NIS_ARGS "-s -S $NIS_DOMAIN,localhost" > /usr/sbin/rcmgr set NIS_PASSWDD YES > /sbin/init.d/nis start 4.1.3 Stop Script The stop script of the ASE service will stop NIS, reconfigure as NIS slave, then restart NIS. This is done in the BOOTING as well as RUNNING section of the stop script so that when rebooting a member that crashed when running NIS master causes the member to come up as NIS slave. > NIS_DOMAIN=`/usr/sbin/rcmgr get NIS_DOMAIN` > /sbin/init.d/nis stop > /usr/sbin/rcmgr set NIS_TYPE SLAVE > /usr/sbin/rcmgr set NIS_ARGS "-s -S $NIS_DOMAIN,localhost" > /usr/sbin/rcmgr set NIS_PASSWDD NO > /sbin/init.d/nis start 4.1.4 /sbin/init.d/nis There is not any reason for running this since ASE manages the NIS processing. Remove the links from /sbin/init.d/rc?.d 4.1.5 nissetup as MASTER (on one selected member) Remember to copy /etc/hosts, /etc/passwd and so on to /var/yp/src. Run nissetup, assign the domain. Other options are not important as the ASE scripts will reconfigure NIS anyway. 4.1.6 nissetup as SLAVE (on the other members) Run nissetup, assign the domain, Enter tmn_nis as server. Other options are not so important as the ASE scripts will reconfigure NIS anyway. Reboot the slave or run the commands of the stop script. 4.1.7 /var/yp/Makefile Change the makedbm command to add the cluster server as NIS server. #MAKEDBM=$(YPDIR)/makedbm MAKEDBM=$(YPDIR)/makedbm -m tmn_nis Do not disable push of NIS maps. login and passwd seem to wait for the update to come from the server. (or rather, they loop around in 'yppoll' (i think) waiting for the change to become visible). See 4.1.8 Run Make 4.1.9 ypservers The names of the NIS servers are kept in the map ypservers. This has to be updated each time a new slave server is added. The problem is that if a server is down, push will hang. Then nobody will be able to log in anyway because the slave servers are updated one by one. The following script, run by root crontab every minute (you may do it less often) pings the servers, then looks if they are up and updates the ypservers map. The script checks if /var/yp/src/ypservers is present, if not the service is not owned by this host. Then /var/yp/src/ypservers is also a convenient place to put the names of the servers. > #!/sbin/sh > PATH=$PATH:/bin:/usr/bin:/sbin:/usr/sbin:/var/yp > > SERVERFILE=/var/yp/src/ypservers > TIMEOUT=10 > MAPDIR=/tmp/ypservers$$ > SERVICE=tmn_nis > > [ -f $SERVERFILE ] || exit 0 > mkdir $MAPDIR || exit 0 > > for Y in `cat $SERVERFILE` > do > if ping -c 1 $Y >/dev/null 2>&1 > then > > $MAPDIR/$Y > fi >> $MAPFILE & > done > > sleep $TIMEOUT > > ls $MAPDIR | awk '{print $0, $0}' | makedbm \ > -m $SERVICE - /var/yp/`domainname`/ypservers > yppush ypservers > rm -rf $MAPDIR 4.2 On other hosts 4.2.1 /etc/hosts Add an entry for tmn_nis 4.2.1 nissetup Set up the hosts with nissetup (according to your slave-or-not policy), the master server is tmn_nis 5 Issues 5.1 XIsso and XSysAdmin These programs cause problems. They perform a test whether the host is the NIS master server. They seem to compare tmn_nis with `hostname` A fix for this is to let tmn_nis be an alias to `hostname` in /etc/hosts. However, the ASE start and stop script must be able to do this since tmn_nis on the standby will be an adress of its own. The following commands ON=NIS_MASTER OFF=NIS_SLAVE HOSTS=/etc/hosts cp $HOSTS $HOSTS.old sed -e 's/^#\(.*\)\(# '$ON'\)/\1\2/' -e 's/\(^[^#].*# '$OFF'\)/#\1/'\ < $HOSTS.old > $HOSTS Will edit /etc/hosts so that lines marked with the comment # NIS_MASTER will be active and lines with the comment # NIS_SLAVE will be commented out. 129.25.30.137 rup.dscc.dk rup tmn_nis # NIS_MASTER #129.25.30.137 rup.dscc.dk rup # NIS_SLAVE #129.25.30.134 tmn_nis.dscc.dk tmn_nis # NIS_SLAVE These may be put into the ASE scripts. 5.2 ypxfr in crontabs Nissetup configures the crontabs on the slave servers to run ypxfr. This is not done on the master server. It does not seem to harm having this active on the master as well as on the slaves. Just remember to configure the crontab on the master as well. When running without push, configure ypxfr_1perhour to get prpasswd and prpasswd_nonsecure as well. 6 Test The test includes one cluster and one node that runs a SLAVE server. 6.1 Perform login, then change password on each 6.2 Run xon tmn_nis /usr/tcb/bin/XIsso from the non-cluster node. 6.3 Shut down the current NIS server 6.4 Run 6.1, 6.2 once again 7 Further suggestions User management is done like this: xon tmn_nis /usr/tcb/bin/XIsso xon tmn_nis /usr/tcb/bin/XSysAdmin login passwd 8 Files 8.1 ASE start script # # A skeleton example of a start action script. # PATH=/sbin:/usr/sbin:/usr/bin:/usr/nm2000/bin export PATH ASETMPDIR=/var/ase/tmp if [ $# -gt 0 ]; then svcName=$1 # Service name to start else svcName= fi # # Reconfigure NIS to run master # /sbin/init.d/nis stop NIS_DOMAIN=`/usr/sbin/rcmgr get NIS_DOMAIN` /usr/sbin/rcmgr set NIS_TYPE MASTER /usr/sbin/rcmgr set NIS_ARGS "-s -S $NIS_DOMAIN,localhost" /usr/sbin/rcmgr set NIS_PASSWDD YES /sbin/init.d/nis start # # Edit /etc/hosts # ON=NIS_MASTER OFF=NIS_SLAVE HOSTS=/etc/hosts cp $HOSTS $HOSTS.old sed -e 's/^#\(.*\)\(# '$ON'\)/\1\2/' -e 's/\(^[^#].*# '$OFF'\)/#\1/'\ < $HOSTS.old > $HOSTS # # Any non zero exit will be considered a failure. # exit 0 8.2 ASE stop script # # A skeleton example of a stop action script. # PATH=/sbin:/usr/sbin:/usr/bin:/usr/nm2000/bin export PATH ASETMPDIR=/var/ase/tmp if [ $# -gt 0 ]; then svcName=$1 # Service name to stop else svcName= fi # # This script runs when the service is stopped, and also when the ASE # is initializing on a member as it boots. You can test the context: # case "${MEMBER_STATE}" in BOOTING | RUNNING) # # Reconfigure NIS to run slave. # NIS_DOMAIN=`/usr/sbin/rcmgr get NIS_DOMAIN` /sbin/init.d/nis stop /usr/sbin/rcmgr set NIS_TYPE SLAVE /usr/sbin/rcmgr set NIS_ARGS "-s -S $NIS_DOMAIN,localhost" /usr/sbin/rcmgr set NIS_PASSWDD NO /sbin/init.d/nis start # # Edit /etc/hosts # OFF=NIS_MASTER ON=NIS_SLAVE HOSTS=/etc/hosts cp $HOSTS $HOSTS.old sed -e 's/^#\(.*\)\(# '$ON'\)/\1\2/' -e 's/\(^[^#].*# '$OFF'\)/#\1/'\ < $HOSTS.old > $HOSTS ;; esac # # exit 0 = success - service stopped successfully # exit 1 = failure - could not stop service # exit 99 = failure - could not stop service (service busy) # exit 0 8.3 /var/yp/pollservers Note that SERVICE=tmn_nis is hardcoded. It could be put into rc.config. #!/sbin/sh PATH=$PATH:/bin:/usr/bin:/sbin:/usr/sbin:/var/yp SERVERFILE=/var/yp/src/ypservers TIMEOUT=10 MAPDIR=/tmp/ypservers$$ SERVICE=tmn_nis [ -f $SERVERFILE ] || exit 0 mkdir $MAPDIR || exit 0 for Y in `cat $SERVERFILE` do if ping -c 1 $Y >/dev/null 2>&1 then > $MAPDIR/$Y fi >> $MAPFILE & done sleep $TIMEOUT ls $MAPDIR | awk '{print $0, $0}' | makedbm \ -m $SERVICE - /var/yp/`domainname`/ypservers yppush ypservers rm -rf $MAPDIR 8.4 /var/yp/src/ypservers rip.dscc.dk rap.dscc.dk rup.dscc.dk 8.5 root crontab # Network Information Service: SLAVE server entries 30 * * * * sh /var/yp/ypxfr_1perhour 31 1,13 * * * sh /var/yp/ypxfr_2perday 32 1 * * * sh /var/yp/ypxfr_1perday # Network Information Service: MASTER server entries * * * * * /var/yp/pollservers 8.6 Makefile Note that SERVICE=tmn_nis is hardcoded. ... .. YPDBDIR=/var/yp YPPUSH=$(YPDIR)/yppush #MAKEDBM=$(YPDIR)/makedbm MAKEDBM=$(YPDIR)/makedbm -m tmn_nis REVNETGROUP=$(YPDIR)/revnetgroup NONSEC=_nonsecure ..