1 #!/bin/sh 2 # 3 # $NetBSD: skeyaudit.sh,v 1.2 1996/09/19 19:44:34 thorpej Exp $ 4 # 5 # This script will look thru the skeykeys file for 6 # people with sequence numbers less then LOWLIMIT=12 7 # and send them an e-mail reminder to use skeyinit soon 8 # 9 10 AWK=/usr/bin/awk 11 GREP=/usr/bin/grep 12 ECHO=/bin/echo 13 KEYDB=/etc/skeykeys 14 LOWLIMIT=12 15 ADMIN=root 16 SUBJECT="Reminder: Run skeyinit" 17 HOST=`/bin/hostname` 18 19 20 if [ "$1" != "" ] 21 then 22 LOWLIMIT=$1 23 fi 24 25 26 # an skeykeys entry looks like 27 # jsw 0076 la13079 ba20a75528de9d3a 28 # the sequence number is the second entry 29 # 30 31 for i in `$AWK '{print $1}' $KEYDB` 32 do 33 SEQ=`$GREP "^$i[ ]" $KEYDB | $AWK '{print $2}'` 34 if [ $SEQ -lt $LOWLIMIT ] 35 then 36 KEY=`$GREP "^$i[ ]" $KEYDB | $AWK '{print $3}'` 37 if [ $SEQ -lt 3 ] 38 then 39 SUBJECT="IMPORTANT action required" 40 fi 41 ( 42 $ECHO "You are nearing the end of your current S/Key sequence for account $i" 43 $ECHO "on system $HOST." 44 $ECHO "" 45 $ECHO "Your S/key sequence number is now $SEQ. When it reaches zero you" 46 $ECHO "will no longer be able to use S/Key to login into the system. " 47 $ECHO " " 48 $ECHO "Type \"skeyinit -s\" to reinitialize your sequence number." 49 $ECHO "" 50 ) | /usr/bin/Mail -s "$SUBJECT" $i $ADMIN 51 fi 52 done 53