Fri, 26 Dec 2014 11:43:45 +0100
Added a Makefile, version 0.22
5 | 1 | #!/bin/bash |
2 | # | |
3 | ############################################################################# | |
18
2b7620bf17e6
Mail default is now just root. Don't send empty mail reports anymore.
Michiel Broek <mbroek@mbse.eu>
parents:
17
diff
changeset
|
4 | # Copyright (C) 2005-2014 |
5 | 5 | # |
15
c4a1470ab59d
Logs check's only yesterdays events, better mailbox check
Michiel Broek <mbroek@mbse.eu>
parents:
13
diff
changeset
|
6 | # Michiel Broek <mbse at mbse.eu> |
5 | 7 | # |
8 | # This file is part of SlackSecCheckSripts. | |
9 | # | |
10 | # This package is free software; you can redistribute it and/or modify it | |
11 | # under the terms of the GNU General Public License as published by the | |
12 | # Free Software Foundation; either version 2, or (at your option) any | |
13 | # later version. | |
14 | # | |
15 | # SlackSecCheckSripts is distributed in the hope that it will be useful, but | |
16 | # WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
18 | # General Public License for more details. | |
19 | # | |
20 | # You should have received a copy of the GNU General Public License | |
21 | # along with MBSE BBS; see the file COPYING. If not, write to the Free | |
22 | # Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. | |
23 | ############################################################################# | |
24 | ||
21
735fe1b89e5a
Fixed wrong changes display when no real files were different
Michiel Broek <mbroek@mbse.eu>
parents:
20
diff
changeset
|
25 | VERSION=0.22 |
5 | 26 | export PATH=/bin:/usr/bin:/sbin:/usr/sbin |
27 | umask 077 | |
28 | LANG=C; export LANG | |
29 | ||
30 | fqdn=`hostname -f` | |
31 | date=`date` | |
32 | ||
33 | if [ "${MAILTO}" = "" ]; then | |
18
2b7620bf17e6
Mail default is now just root. Don't send empty mail reports anymore.
Michiel Broek <mbroek@mbse.eu>
parents:
17
diff
changeset
|
34 | MAILTO=root |
5 | 35 | fi |
36 | ||
20
1d18ebb9e279
Fixed permission errors on .gvfs virtual filesystems. Bumped to version 0.21
Michiel Broek <mbroek@mbse.eu>
parents:
19
diff
changeset
|
37 | DAILYDIR=$(mktemp -d /tmp/_daily.XXXXXX) || exit 1 |
5 | 38 | SECOUT="$DAILYDIR/secout" |
39 | TMP1="$DAILYDIR/tmp1" | |
40 | ||
41 | trap "/bin/rm -rf $DAILYDIR ; exit 0" EXIT INT QUIT | |
42 | ||
43 | if ! cd "$DAILYDIR"; then | |
44 | echo "Can not cd to $DAILYDIR". | |
45 | exit 1 | |
46 | fi | |
47 | ||
48 | ||
49 | # Check chk_* scripts in /etc/security.d which are executable | |
50 | # and run them. Any script output is appended to the report | |
51 | # | |
52 | for f in `/bin/ls /etc/security.d/chk_*` | |
53 | do | |
54 | if [ -x $f ]; then | |
55 | rm -f $TMP1 | |
56 | $f > $TMP1 | |
57 | if [ -s $TMP1 ]; then | |
10 | 58 | if [ ! -f $SECOUT ]; then |
59 | echo "" >> $SECOUT | |
60 | echo " SlackSecCheckSripts v${VERSION}" >> $SECOUT | |
61 | echo "" >> $SECOUT | |
62 | fi | |
5 | 63 | cat $TMP1 >> $SECOUT |
64 | echo "" >> $SECOUT | |
65 | echo "------------------------------------------------------------------------------" >> $SECOUT | |
66 | fi | |
67 | fi | |
68 | done | |
69 | ||
19
2c0dacb26b14
Fixed error message when there was nothing to report.
Michiel Broek <mbroek@mbse.eu>
parents:
18
diff
changeset
|
70 | if [ -s "$SECOUT" ]; then |
2c0dacb26b14
Fixed error message when there was nothing to report.
Michiel Broek <mbroek@mbse.eu>
parents:
18
diff
changeset
|
71 | env MAILRC=/dev/null mail -s "$fqdn daily insecurity output for $date" $MAILTO < $SECOUT |
2c0dacb26b14
Fixed error message when there was nothing to report.
Michiel Broek <mbroek@mbse.eu>
parents:
18
diff
changeset
|
72 | fi |
2c0dacb26b14
Fixed error message when there was nothing to report.
Michiel Broek <mbroek@mbse.eu>
parents:
18
diff
changeset
|
73 |