#!/bin/sh
#; vrfylf.sh
#; Check to see if syslog files listed in /etc/syslog.conf exist.
#; If not, touch them.
#;
#; Author:   DePaul University Information Security Team
#;           <http://infosec.depaul.edu/>
#;           Copyright (c) 2003. DePaul University. All Rights Reserved.
#;
#; Platform: Tested on the following platforms:
#;              OpenBSD 3.2
#;
#; Revised:  $Id: vrfylf.sh,v 1.1.1.1 2003/09/25 19:23:57 epancer Exp $     
#;

#; For debugging...
#set -x

PATH="/usr/sbin:/usr/bin:/sbin:/bin"
umask 077

SYSLOGCONF="/etc/syslog.conf"
LOGDIR="/var/log"
LOGFILES="`egrep -v '^#' $SYSLOGCONF  | grep $LOGDIR | awk '{ print $2 }'`"

chkyn () {
 read ok
 case ${ok} in 
  [yY]*)  return 0 ;;
  [nN]*)  return 1 ;;
   *)  echo " !! You're typing is bad and I didn't understand that (y/n) "
  chkyn;;
 esac
}

vrfylf() {
   for filenames in $LOGFILES; do
     if [ ! -f "$filenames" ]; then
      echo "  ! $filenames does not exist, create? (y/n)"
       if (chkyn) ; then
        echo "  + creating $filenames,"
        touch $filenames
       fi
     else
      echo "  - $filenames exists,"
     fi
   done
}

echo " * Verifying logfiles exist..."

vrfylf

echo " * ...done."

#; 
# vim: ts=8 sw=8 nowrap
#; 
