#!/bin/ksh ## ## SCRIPT: sho_userid_mailalias_mismatch ## ## Where : in $FEDIR/scripts where $FEDIR=/apps/nns_com/fea ## ##################################################################### ## PURPOSE: Shows mismatches between SGI userids (via NIS, 'ypcat passwd') ## and userids in the $SERVER:/etc/aliases file. ## ## Can be used to alert SGI SysAdmins as to userids (and ## corresponding corporate e-mail address) to add to ## $SERVER:/etc/aliases. ## ## Facilitates proper operation of mail forwarding from SGI ## applications (like mail notifications within I-DEAS, ## for Team Data Management part/assembly updates), via ## Unix mail commands like 'Mail'. ## ##################################################################### ## CALL FORMAT: 'mailtools' toolchest drawer ## or ## feamain -> office_utils.menu -> mailhelp.menu ## (or manually) ## ##################################################################### ## MAINTENANCE HISTORY: ## Written by : B. Montandon 12Apr2000 Based on similar code in ## 'chk_aliases4varmail' and ## 'userids' or 'userids_bydept' in $FEDIR/scripts ## Last Update: B. Montandon 17Nov2000 Improve report format; move ## script into to report 'trailer'. ## ##################################################################### if test "$FEDIR" = "" then export FEDIR=/apps/nns_com/fea fi THISHOST=`hostname` SERVER="engprd00" ####################################################################### ## PREP REPORT FILENAME in $OUTLIST, and make file names ## for the 'ypcat passwd' and /etc/aliases userid-lists. ####################################################################### . $FEDIR/scripts/set_localoutlist OUTLISTpasswd=${OUTLIST}_passwd_userids OUTLISTalias=${OUTLIST}_mail_alias_userids ####################################################################### ## PREP HEADING OF REPORT, in file $OUTLIST. ####################################################################### echo "\ ******************** `date '+%Y %b %d %a %T%p %Z'` ****************** MIS-MATCHES OF SGI LOGIN-USERIDS & SGI MAIL-ALIAS-USERIDS. Run at host $THISHOST *************************************************************************** If your userid appears in the left column and you are NOT receiving mail-by-userid, such as I-DEAS Team notifications of part/assembly updates, then it MAY be the case that a line with your userid and corporate-mail-address is missing from the 'central' /etc/aliases file. Contact an SGI System Administrator to have mismatches for CURRENT employees corrected --- example: corporate mail address is needed in $SERVER:/etc/aliases. Also, contact an SGI System Administrator to have OLD employee userids removed. *************************************************************************** Some more information is at the bottom of this list. ___________________________________________________________________________ Login userids without Userids in $SERVER:/etc/aliases a mail alias entry in that apparently are NOT allowed $SERVER:/etc/aliases a 'network' SGI login (NIS authorized). ---------------------- -------------------------------------- " > $OUTLIST ## FOR TESTING: # set -x ####################################################################### ## PREP LIST OF USERIDS FROM NIS, 'ypcat passwd' --- in file $OUTLISTpasswd. ####################################################################### ypcat passwd | sort -t: +0 -n | awk -F: '{printf "%s\n", $1}' > $OUTLISTpasswd ####################################################################### ## PREP LIST OF USERIDS FROM THE $SERVER:/etc/aliases FILE --- ## in file $OUTLISTalias. ####################################################################### . $FEDIR/scripts/mak_rhosts rsh $SERVER cut -d: -f1 /etc/aliases | sort > $OUTLISTalias ####################################################################### ## PREP THE BODY OF THE REPORT. ####################################################################### ## Add the differences image to $OUTLIST. ## These are userids w/o 'matches'. ## Add line-numbering. ####################################################################### # diff $OUTLISTpasswd $OUTLISTalias >> $OUTLIST diff $OUTLISTpasswd $OUTLISTalias | \ egrep -v ',|---|[0-9][0-9]*[dac][0-9][0-9]*' | \ sed 's|>| |;s|< ||' | \ nl >> $OUTLIST ####################################################################### ## PREP TRAILER FOR THE REPORT, in file $OUTLIST. ####################################################################### echo " ____________________________________________________________________________ This list is generated by the script $0 This 'MIS-MATCHES OF SGI LOGIN-USERIDS & SGI MAIL-ALIAS-USERIDS' utility can be run via a 'mailtools' command-toolchest drawer. ____________________________________________________________________________ This script/utility lists the DIFFERENCES (MIS-MATCHES) between - USERIDS in the 1st column of the $SERVER:/etc/aliases file (a file for translating userids to corporate mail addresses) Example line in an /etc/aliases file: abc00:cooper_ab@nns.com and - USERIDS allowed to login to SGI machines (given by NIS, 'ypcat passwd'). NIS = Network Information Service Example line from an NIS 'ypcat passwd' query: abc00:...:20:A B Cooper ,e99:/usr/people/abc00:/bin/ksh ____________________________________________________________________________ " >> $OUTLIST ####################################################################### ## SHOW THE REPORT FILE ####################################################################### $FEDIR/scripts/shofil $OUTLIST xdiff $OUTLISTpasswd $OUTLISTalias &