cron.daily/security

changeset 0
8ba6a0e2d2ca
child 10
e9b5e53f1d0b
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cron.daily/security	Sat Mar 31 13:32:06 2007 +0200
@@ -0,0 +1,74 @@
+#!/bin/bash
+#
+# $Id$
+#
+#############################################################################
+# Copyright (C) 2005
+#   
+# Michiel Broek               <mbse@mbse.dds.nl>
+# Beekmansbos 10
+# 1971 BV IJmuiden
+# the Netherlands
+#
+# This file is part of SlackSecCheckSripts.
+#
+# This package is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation; either version 2, or (at your option) any
+# later version.
+#
+# SlackSecCheckSripts is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with MBSE BBS; see the file COPYING.  If not, write to the Free
+# Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+#############################################################################
+
+export PATH=/bin:/usr/bin:/sbin:/usr/sbin
+umask 077
+LANG=C; export LANG
+
+fqdn=`hostname -f`
+date=`date`
+
+if [ "${MAILTO}" = "" ]; then
+    MAILTO=root@$fqdn
+fi
+
+DAILYDIR=`mktemp -d /tmp/_daily.XXXXXX` || exit 1
+SECOUT="$DAILYDIR/secout"
+TMP1="$DAILYDIR/tmp1"
+
+trap "/bin/rm -rf $DAILYDIR ; exit 0" EXIT INT QUIT
+
+if ! cd "$DAILYDIR"; then
+    echo "Can not cd to $DAILYDIR".
+    exit 1
+fi
+
+
+# Check chk_* scripts in /etc/security.d which are executable
+# and run them. Any script output is appended to the report
+#
+for f in `/bin/ls /etc/security.d/chk_*`
+do
+    if [ -x $f ]; then
+	rm -f $TMP1
+	$f > $TMP1
+	if [ -s $TMP1 ]; then
+	    cat $TMP1 >> $SECOUT
+	    echo "" >> $SECOUT
+	    echo "------------------------------------------------------------------------------" >> $SECOUT
+	fi
+    fi
+done
+
+
+if [ ! -s "$SECOUT" ]; then
+    echo "Nothing to report on $date" > $SECOUT
+fi
+env MAILRC=/dev/null mail -s "$fqdn daily insecurity output for $date" $MAILTO < $SECOUT
+

mercurial