|
1 #!/bin/bash |
|
2 # |
|
3 # $Id$ |
|
4 # |
|
5 ############################################################################# |
|
6 # Copyright (C) 2005 |
|
7 # |
|
8 # Michiel Broek <mbse@mbse.dds.nl> |
|
9 # Beekmansbos 10 |
|
10 # 1971 BV IJmuiden |
|
11 # the Netherlands |
|
12 # |
|
13 # This file is part of SlackSecCheckSripts. |
|
14 # |
|
15 # This package is free software; you can redistribute it and/or modify it |
|
16 # under the terms of the GNU General Public License as published by the |
|
17 # Free Software Foundation; either version 2, or (at your option) any |
|
18 # later version. |
|
19 # |
|
20 # SlackSecCheckSripts is distributed in the hope that it will be useful, but |
|
21 # WITHOUT ANY WARRANTY; without even the implied warranty of |
|
22 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
23 # General Public License for more details. |
|
24 # |
|
25 # You should have received a copy of the GNU General Public License |
|
26 # along with MBSE BBS; see the file COPYING. If not, write to the Free |
|
27 # Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. |
|
28 ############################################################################# |
|
29 |
|
30 export PATH=/bin:/usr/bin:/sbin:/usr/sbin |
|
31 umask 077 |
|
32 LANG=C; export LANG |
|
33 |
|
34 fqdn=`hostname -f` |
|
35 date=`date` |
|
36 |
|
37 if [ "${MAILTO}" = "" ]; then |
|
38 MAILTO=root@$fqdn |
|
39 fi |
|
40 |
|
41 DAILYDIR=`mktemp -d /tmp/_daily.XXXXXX` || exit 1 |
|
42 SECOUT="$DAILYDIR/secout" |
|
43 TMP1="$DAILYDIR/tmp1" |
|
44 |
|
45 trap "/bin/rm -rf $DAILYDIR ; exit 0" EXIT INT QUIT |
|
46 |
|
47 if ! cd "$DAILYDIR"; then |
|
48 echo "Can not cd to $DAILYDIR". |
|
49 exit 1 |
|
50 fi |
|
51 |
|
52 |
|
53 # Check chk_* scripts in /etc/security.d which are executable |
|
54 # and run them. Any script output is appended to the report |
|
55 # |
|
56 for f in `/bin/ls /etc/security.d/chk_*` |
|
57 do |
|
58 if [ -x $f ]; then |
|
59 rm -f $TMP1 |
|
60 $f > $TMP1 |
|
61 if [ -s $TMP1 ]; then |
|
62 cat $TMP1 >> $SECOUT |
|
63 echo "" >> $SECOUT |
|
64 echo "------------------------------------------------------------------------------" >> $SECOUT |
|
65 fi |
|
66 fi |
|
67 done |
|
68 |
|
69 |
|
70 if [ ! -s "$SECOUT" ]; then |
|
71 echo "Nothing to report on $date" > $SECOUT |
|
72 fi |
|
73 env MAILRC=/dev/null mail -s "$fqdn daily insecurity output for $date" $MAILTO < $SECOUT |
|
74 |