#!/bin/ksh ## ## SCRIPT: sho_userid_mailalias_match ## ## Where : in $FEDIR/scripts where $FEDIR=/apps/nns_com/fea ## ##################################################################### ## PURPOSE: Show a list of userids that appear in both ## 1) the list of SGI userids (via NIS, 'ypcat passwd') ## and ## 2) the list of userids in the $SERVER:/etc/aliases file. ## ## I.e. show the userid *matches* in the two lists: ## 1) a list of userids that can login to SGI machines ## 2) a list of userids with mail aliases (in a ## 'central' /etc/aliases file). ## ## Can be used to indicate to SGI AppAdmins & SysAdmins as to userids ## that are authorized to login to SGI's AND that have a corporate ## e-mail address in $SERVER:/etc/aliases. ## ## Helps corroborate 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 13Apr2000 Based on similar code in ## 'sho_userid_mailalias_mismatch' ## 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'` ****************** MATCHES OF SGI LOGIN-USERIDS & SGI MAIL-ALIAS-USERIDS. Run at host $THISHOST A list of userids with BOTH 1) authorization to login to SGI machines (as per NIS, 'ypcat passwd') and 2) a corporate mail alias entry in $SERVER:/etc/aliases . *************************************************************************** * Contact an SGI System Administrator if your userid does NOT * appear in this list, yet you are able to login to SGI machines * on the NNS network. * * A line with your userid and corporate-mail-address * is probably missing from the 'central' /etc/aliases file. * * Have an SGI System Administrator add * your userid and corporate-mail-address * to the 'central' /etc/aliases file. *************************************************************************** Some more information is at the bottom of this list. ___________________________________________________________________________ " > $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. ####################################################################### ## Put the duplicate userids from the merged alias&passwd files ## (via 'sort -m') to $OUTLIST. These are 'matching' userids. ## Add line-numbering. ####################################################################### sort -m $OUTLISTpasswd $OUTLISTalias \ | uniq -d | nl >> $OUTLIST ####################################################################### ## PREP TRAILER FOR THE REPORT, in file $OUTLIST. ####################################################################### echo " ____________________________________________________________________________ This userid list was generated by the script $0 This 'MATCHES OF SGI LOGIN-USERIDS & SGI MAIL-ALIAS-USERIDS' utility can be run via a 'mailtools' command-toolchest drawer. ___________________________________________________________________________ This script/utility lists those SGI *USERIDS* in BOTH - 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 - a list of users 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. And use 'xdiff' to show the differences ## between the 'ypcat passwd' and /etc/aliases userid-lists. ####################################################################### $FEDIR/scripts/shofil $OUTLIST xdiff $OUTLISTpasswd $OUTLISTalias &