#!/bin/sh # James W. Meritt #This is a program to check the setup/operability of a system echo "setting variables" # set some variables used HOSTNAME="`/usr/ucb/hostname`" TODAY="`/bin/date | cut -c5-10`" USERNAME="`/usr/ucb/whoami`" # echo "setting directories" # These are the directories used # The home directory of the username that will be operating this system HOMEDIR="/home/meritj" # The home directory of the Computer Oracle and Password System COPSDIR="$HOMEDIR/cops" # The base directory of the windows applications OPENWINHOME="/usr/openwin" # The base directory of this program CHECKDIR="$HOMEDIR/setup" # echo "setting programs" # programs which are necessary for the operation of this script ECHO="/usr/ucb/echo" AWK="/bin/awk" GREP="/bin/grep" FGREP="/bin/fgrep" CUT="/bin/cut" DATE="/bin/date" CAT="/bin/cat" PING="/usr/sbin/ping" TELNET="/usr/ucb/telnet" NETSTAT="/usr/ucb/netstat" SWAP="/usr/sbin/swap" MAN="/bin/man" DF="/usr/ucb/df" W="/usr/ucb/w" NSLOOKUP="/usr/sbin/nslookup" WHOAMI="/usr/ucb/whoami" NISCAT="/bin/niscat" SORT="/bin/sort" LS="/bin/ls" FILE="/usr/ucb/file" LPSTAT="/bin/lpstat" MORE="/usr/ucb/more" DIFF="/bin/diff" MAILER="/usr/ucb/mail" TAIL="/usr/ucb/tail" HEAD="/usr/ucb/head" SLEEP="/bin/sleep" STROBE="$CHECKDIR/strobe" SHOWREV="/bin/showrev" # echo "setting tmp files" # temporary files TMPFILE1="/tmp/tmp1`$DATE +%M%S`" TMPFILE2="/tmp/tmp2`$DATE +%M%S`" TMPFILE3="/tmp/tmp3`$DATE +%M%S`" SRVFILE="/tmp/srv`$DATE +%M%S`" $ECHO "Now commence the tests" $ECHO "_________________________________________________________________" $ECHO "show machine and software revision information" $SHOWREV | $MORE $SLEEP 5 $ECHO " " $ECHO "checking date/time..." $DATE $SLEEP 10 $ECHO " " $ECHO "looking up own name on the nameserver" $NSLOOKUP $HOSTNAME $SLEEP 10 $ECHO " " $ECHO "Check disk space..." $DF -t 4.2 $SLEEP 1 $ECHO " " $ECHO "Make sure these directories are present..." # directories taken from default root path for DIRECTORY in $OPENWINHOME/bin /usr/ucb /usr/bin /usr/sbin /etc/us /usr/local/bin /usr/local/scripts do $FILE $DIRECTORY $SLEEP 1 done $SLEEP 1 $ECHO " " $ECHO "As the system scans, look to ensure that the services desired, and ONLY the" $ECHO "services desired, appear." $ECHO -n "Port check " END="`$GREP -v '^#' /etc/services | $GREP tcp |$TAIL -1 | $CUT -f1 -d'/' | $CUT -c5-80`" echo "beginning at 1 and ending at $END " $STROBE -b 1 -e $END localhost $SLEEP 1 $ECHO " " $ECHO "The following is a check of the various mount tables, the automounter, and" $ECHO "the overall operation of the network doing the automatic mounts." $ECHO "Check that stuff is mounted correctly:" $CAT /etc/vfstab | $AWK '{ print $3 }' > $TMPFILE1 $NISCAT auto_direct.org_dir | $AWK '{ print $1 }' >> $TMPFILE1 DIRECTORIES="`$SORT -u $TMPFILE1 | $GREP '/'`" for DIRECTORY in $DIRECTORIES do $ECHO ". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ." $ECHO "Checking directory $DIRECTORY " cd $DIRECTORY $LS > /dev/null $DF $DIRECTORY $SLEEP 5 done $ECHO ". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ." $SLEEP 1 $ECHO " " #confirm can reach default gateway $ECHO "confirm presence of defaultrouter file" $LS -l /etc/defaultrouter $ECHO -n "pinging default gateway:" $PING "`$CAT /etc/defaultrouter`" $SLEEP 1 # make sure HAS a route table! $ECHO "looking for the default route in the route tables" $NETSTAT -r | grep default $SLEEP 5 $ECHO " " #load within parameters $ECHO "checking load..." $W | $HEAD -1 $SLEEP 1 $ECHO " " #send/receive email $ECHO "Operate mailer verbosely to check sending and receiving email..." $ECHO "This is a test " | $MAILER -v $USERNAME $SLEEP 10 $ECHO " " #errors in logs? $ECHO "Checking logs for hardware errors..." $FGREP -f $CHECKDIR/system.error /var/adm/messages | $GREP "$TODAY" | cut -c8-110 $SLEEP 10 $ECHO " " #check ftp $ECHO "Is the command 'ftp' available?" WFILE=`which ftp | grep ftp` $LS -l $WFILE $ECHO "Is the system setup to receive ftp?" $GREP ftp /etc/services $GREP ftp /etc/inetd.conf $SLEEP 10 $ECHO " " #check swap space $ECHO "Checking swap space..." $SWAP -l $SLEEP 10 $ECHO " " $ECHO "Checking manual pages..." $MAN -F man $SLEEP 10 $ECHO " " $ECHO "Examine system specification file for errors" $MORE /etc/system $SLEEP 10 $ECHO " " $ECHO "Confirm viability of all default shells" # /etc/passwd default shells $CUT -f7 -d: /etc/passwd > $TMPFILE3 $NISCAT passwd.org_dir | $CUT -f7 -d: >> $TMPFILE3 SHELLS="`$SORT -u $TMPFILE3`" # they really exist and are executable for DSHELL in $SHELLS do $ECHO ". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ." $FILE $DSHELL $LS -l $DSHELL done $ECHO ". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ." $SLEEP 10 $ECHO " " $ECHO "Check the printer situation" $LPSTAT -t # make sure HAS a printer $ECHO " " $SLEEP 5 #confirm environmental variables $ECHO "Environmental variables..." set | $MORE $SLEEP 10 $ECHO " " #Check /etc/default/login $ECHO "Ensure that these values are correct: " $MORE /etc/default/login $SLEEP 15 $ECHO " " $ECHO "Ensure necessary entries in /etc/hosts" $CAT /etc/hosts $SLEEP 5 $ECHO " " $ECHO "Ensure necessary entries in /.rhosts" $CAT /.rhosts $SLEEP 5 $ECHO " " #/usr/local/scripts/cproot $ECHO "compare base setup configurations to ones in root:" $DIFF /usr/local/menu/root-login /.login $DIFF /usr/local/menu/root-cshrc /.cshrc $DIFF /usr/local/menu/root-profile /.profile $DIFF /usr/local/menu/root-forward /.forward $DIFF /usr/local/menu/root-openwin-menu /.openwin-menu $DIFF /usr/local/menu/root-OWdefaults /.OWdefaults $DIFF /usr/local/menu/root-Xdefaults /Xdefaults $DIFF /usr/local/menu/root-openwin-init /.openwin-init $DIFF /usr/local/menu/root-openwin-menu-programs /.openwin-menu-programs $DIFF /usr/local/menu/root-xinitrc /.xinitrc $SLEEP 15 $ECHO " " $ECHO "Checking permissions..." cd / $ECHO ". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . " $ECHO "permissions 600 .rhosts?" $LS -l /.rhosts $ECHO ". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . " $ECHO "permissions 754?" for FILE in .cshrc .login .profile .OWdefaults .openwin-init do $LS -l $FILE done $ECHO ". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . " $ECHO "permission 644?" for FILE in .forward .openwin-menu .xinitrc .openwin-menu-programs Xdefaults do $LS -l $FILE done $ECHO ". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . " $ECHO " sysadmin group?" for FILE in .forward .openwin-menu .xinitrc .openwin-menu-programs Xdefaults .cshrc .login .profile .OWdefaults .openwin-init .rhosts do $LS -l $FILE done $SLEEP 15 $ECHO " " $ECHO "Check the message of the day..." $MORE /etc/motd $SLEEP 1 $ECHO " " #/.forward set $ECHO "Where does root mail go?" $CAT /.forward $SLEEP 5 $ECHO " " # You need COPS (Computer Oracle and Password System) already set up. #$ECHO "running COPS (Computer Oracle and Password System) ..." #$COPSDIR/cops # return to the systems base directory cd $CHECKDIR $ECHO "All done \!"