cron.daily/security

Tue, 15 Apr 2014 14:45:38 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Tue, 15 Apr 2014 14:45:38 +0200
changeset 20
1d18ebb9e279
parent 19
2c0dacb26b14
child 21
735fe1b89e5a
permissions
-rw-r--r--

Fixed permission errors on .gvfs virtual filesystems. Bumped to version 0.21

5
fe3130d22800 Conversion from CVS
Mercurial Repos
parents:
diff changeset
1 #!/bin/bash
fe3130d22800 Conversion from CVS
Mercurial Repos
parents:
diff changeset
2 #
fe3130d22800 Conversion from CVS
Mercurial Repos
parents:
diff changeset
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
fe3130d22800 Conversion from CVS
Mercurial Repos
parents:
diff changeset
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
fe3130d22800 Conversion from CVS
Mercurial Repos
parents:
diff changeset
7 #
fe3130d22800 Conversion from CVS
Mercurial Repos
parents:
diff changeset
8 # This file is part of SlackSecCheckSripts.
fe3130d22800 Conversion from CVS
Mercurial Repos
parents:
diff changeset
9 #
fe3130d22800 Conversion from CVS
Mercurial Repos
parents:
diff changeset
10 # This package is free software; you can redistribute it and/or modify it
fe3130d22800 Conversion from CVS
Mercurial Repos
parents:
diff changeset
11 # under the terms of the GNU General Public License as published by the
fe3130d22800 Conversion from CVS
Mercurial Repos
parents:
diff changeset
12 # Free Software Foundation; either version 2, or (at your option) any
fe3130d22800 Conversion from CVS
Mercurial Repos
parents:
diff changeset
13 # later version.
fe3130d22800 Conversion from CVS
Mercurial Repos
parents:
diff changeset
14 #
fe3130d22800 Conversion from CVS
Mercurial Repos
parents:
diff changeset
15 # SlackSecCheckSripts is distributed in the hope that it will be useful, but
fe3130d22800 Conversion from CVS
Mercurial Repos
parents:
diff changeset
16 # WITHOUT ANY WARRANTY; without even the implied warranty of
fe3130d22800 Conversion from CVS
Mercurial Repos
parents:
diff changeset
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
fe3130d22800 Conversion from CVS
Mercurial Repos
parents:
diff changeset
18 # General Public License for more details.
fe3130d22800 Conversion from CVS
Mercurial Repos
parents:
diff changeset
19 #
fe3130d22800 Conversion from CVS
Mercurial Repos
parents:
diff changeset
20 # You should have received a copy of the GNU General Public License
fe3130d22800 Conversion from CVS
Mercurial Repos
parents:
diff changeset
21 # along with MBSE BBS; see the file COPYING. If not, write to the Free
fe3130d22800 Conversion from CVS
Mercurial Repos
parents:
diff changeset
22 # Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
fe3130d22800 Conversion from CVS
Mercurial Repos
parents:
diff changeset
23 #############################################################################
fe3130d22800 Conversion from CVS
Mercurial Repos
parents:
diff changeset
24
20
1d18ebb9e279 Fixed permission errors on .gvfs virtual filesystems. Bumped to version 0.21
Michiel Broek <mbroek@mbse.eu>
parents: 19
diff changeset
25 VERSION=0.21
5
fe3130d22800 Conversion from CVS
Mercurial Repos
parents:
diff changeset
26 export PATH=/bin:/usr/bin:/sbin:/usr/sbin
fe3130d22800 Conversion from CVS
Mercurial Repos
parents:
diff changeset
27 umask 077
fe3130d22800 Conversion from CVS
Mercurial Repos
parents:
diff changeset
28 LANG=C; export LANG
fe3130d22800 Conversion from CVS
Mercurial Repos
parents:
diff changeset
29
fe3130d22800 Conversion from CVS
Mercurial Repos
parents:
diff changeset
30 fqdn=`hostname -f`
fe3130d22800 Conversion from CVS
Mercurial Repos
parents:
diff changeset
31 date=`date`
fe3130d22800 Conversion from CVS
Mercurial Repos
parents:
diff changeset
32
fe3130d22800 Conversion from CVS
Mercurial Repos
parents:
diff changeset
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
fe3130d22800 Conversion from CVS
Mercurial Repos
parents:
diff changeset
35 fi
fe3130d22800 Conversion from CVS
Mercurial Repos
parents:
diff changeset
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
fe3130d22800 Conversion from CVS
Mercurial Repos
parents:
diff changeset
38 SECOUT="$DAILYDIR/secout"
fe3130d22800 Conversion from CVS
Mercurial Repos
parents:
diff changeset
39 TMP1="$DAILYDIR/tmp1"
fe3130d22800 Conversion from CVS
Mercurial Repos
parents:
diff changeset
40
fe3130d22800 Conversion from CVS
Mercurial Repos
parents:
diff changeset
41 trap "/bin/rm -rf $DAILYDIR ; exit 0" EXIT INT QUIT
fe3130d22800 Conversion from CVS
Mercurial Repos
parents:
diff changeset
42
fe3130d22800 Conversion from CVS
Mercurial Repos
parents:
diff changeset
43 if ! cd "$DAILYDIR"; then
fe3130d22800 Conversion from CVS
Mercurial Repos
parents:
diff changeset
44 echo "Can not cd to $DAILYDIR".
fe3130d22800 Conversion from CVS
Mercurial Repos
parents:
diff changeset
45 exit 1
fe3130d22800 Conversion from CVS
Mercurial Repos
parents:
diff changeset
46 fi
fe3130d22800 Conversion from CVS
Mercurial Repos
parents:
diff changeset
47
fe3130d22800 Conversion from CVS
Mercurial Repos
parents:
diff changeset
48
fe3130d22800 Conversion from CVS
Mercurial Repos
parents:
diff changeset
49 # Check chk_* scripts in /etc/security.d which are executable
fe3130d22800 Conversion from CVS
Mercurial Repos
parents:
diff changeset
50 # and run them. Any script output is appended to the report
fe3130d22800 Conversion from CVS
Mercurial Repos
parents:
diff changeset
51 #
fe3130d22800 Conversion from CVS
Mercurial Repos
parents:
diff changeset
52 for f in `/bin/ls /etc/security.d/chk_*`
fe3130d22800 Conversion from CVS
Mercurial Repos
parents:
diff changeset
53 do
fe3130d22800 Conversion from CVS
Mercurial Repos
parents:
diff changeset
54 if [ -x $f ]; then
fe3130d22800 Conversion from CVS
Mercurial Repos
parents:
diff changeset
55 rm -f $TMP1
fe3130d22800 Conversion from CVS
Mercurial Repos
parents:
diff changeset
56 $f > $TMP1
fe3130d22800 Conversion from CVS
Mercurial Repos
parents:
diff changeset
57 if [ -s $TMP1 ]; then
10
e9b5e53f1d0b Report scripts version
Michiel Broek <mbroek@mbse.eu>
parents: 5
diff changeset
58 if [ ! -f $SECOUT ]; then
e9b5e53f1d0b Report scripts version
Michiel Broek <mbroek@mbse.eu>
parents: 5
diff changeset
59 echo "" >> $SECOUT
e9b5e53f1d0b Report scripts version
Michiel Broek <mbroek@mbse.eu>
parents: 5
diff changeset
60 echo " SlackSecCheckSripts v${VERSION}" >> $SECOUT
e9b5e53f1d0b Report scripts version
Michiel Broek <mbroek@mbse.eu>
parents: 5
diff changeset
61 echo "" >> $SECOUT
e9b5e53f1d0b Report scripts version
Michiel Broek <mbroek@mbse.eu>
parents: 5
diff changeset
62 fi
5
fe3130d22800 Conversion from CVS
Mercurial Repos
parents:
diff changeset
63 cat $TMP1 >> $SECOUT
fe3130d22800 Conversion from CVS
Mercurial Repos
parents:
diff changeset
64 echo "" >> $SECOUT
fe3130d22800 Conversion from CVS
Mercurial Repos
parents:
diff changeset
65 echo "------------------------------------------------------------------------------" >> $SECOUT
fe3130d22800 Conversion from CVS
Mercurial Repos
parents:
diff changeset
66 fi
fe3130d22800 Conversion from CVS
Mercurial Repos
parents:
diff changeset
67 fi
fe3130d22800 Conversion from CVS
Mercurial Repos
parents:
diff changeset
68 done
fe3130d22800 Conversion from CVS
Mercurial Repos
parents:
diff changeset
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

mercurial