cron.daily/security

Tue, 22 Sep 2009 20:26:20 +0200

author
root@seaport.mbse.ym
date
Tue, 22 Sep 2009 20:26:20 +0200
changeset 13
cc078ac2fddd
parent 10
e9b5e53f1d0b
child 15
c4a1470ab59d
permissions
-rw-r--r--

Allow underscore in account names

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

mercurial