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