[BACK]Return to skeyaudit.sh CVS log [TXT][DIR] Up to [local] / src / usr.bin / skey

File: [local] / src / usr.bin / skey / Attic / skeyaudit.sh (download)

Revision 1.4, Sun Sep 29 04:46:18 1996 UTC (27 years, 8 months ago) by millert
Branch: MAIN
CVS Tags: OPENBSD_2_1_BASE, OPENBSD_2_1, OPENBSD_2_0_BASE, OPENBSD_2_0
Changes since 1.3: +3 -3 lines

Will now work with SHA when it happens.

#!/bin/sh
# $OpenBSD: skeyaudit.sh,v 1.4 1996/09/29 04:46:18 millert Exp $
# This script will look thru the skeykeys file for
# people with sequence numbers less then LOWLIMIT=12
# and send them an e-mail reminder to use skeyinit soon
# 

AWK=/usr/bin/awk
GREP=/usr/bin/grep
ECHO=/bin/echo
KEYDB=/etc/skeykeys
LOWLIMIT=12
ADMIN=root
SUBJECT="Reminder: Run skeyinit"
HOST=`/bin/hostname`


if [ "$1" != "" ]
then
 LOWLIMIT=$1
fi


# an skeykeys entry looks like
#   jsw 0076 la13079          ba20a75528de9d3a
# the sequence number is the second entry
#

for i in `$AWK '{print $1}' $KEYDB`
do
SEQ=`$GREP "^$i[ 	]" $KEYDB | $AWK '{if ($2 ~ /^[A-z]/) {print $3} else {print $2}}'`
if [ $SEQ -lt $LOWLIMIT ]
then
  KEY=`$GREP "^$i[ 	]" $KEYDB | $AWK '{if ($2 ~ /^[A-z]/) {print $4} else {print $3}}'`
  if [ $SEQ -lt  3 ]
  then
  SUBJECT="IMPORTANT action required"
  fi
  (
  $ECHO "You are nearing the end of your current S/Key sequence for account $i"
  $ECHO "on system $HOST."
  $ECHO ""
  $ECHO "Your S/key sequence number is now $SEQ.  When it reaches zero you"
  $ECHO "will no longer be able to use S/Key to login into the system.  "
  $ECHO " "
  $ECHO "Type \"skeyinit -s\" to reinitialize your sequence number."
  $ECHO ""
  ) | /usr/bin/Mail -s "$SUBJECT"  $i  $ADMIN
fi
done