#!/bin/sh - # # # Show succesful logins # # If there is a global system configuration file, suck it in. # if [ -r /etc/defaults/periodic.conf ] then . /etc/defaults/periodic.conf source_periodic_confs fi LOG="${daily_status_security_logdir}" yesterday=`date -v-1d "+%b %e "` catmsgs() { find ${LOG} -name 'auth.log.*' -mtime -2 | sort -t. -r -n -k 2,2 | while read f do case $f in *.gz) zcat -f $f;; *.bz2) bzcat -f $f;; esac done [ -f ${LOG}/auth.log ] && cat $LOG/auth.log } case "$daily_status_security_loginok_enable" in [Yy][Ee][Ss]) echo "" echo "${host} succesful logins:" n=$(catmsgs | grep -ia "^$yesterday.*[Aa]ccept" | tee /dev/stderr | wc -l) [ $n -gt 0 ] && rc=1 || rc=0;; *) rc=0;; esac exit $rc