Mon, 18 Feb 2013 19:47:24 +0100
Fixed check mailq on ssmtp systems
5 | 1 | #!/bin/bash |
2 | # | |
3 | ############################################################################# | |
14
59e07bba67cc
Fixed spelling error, updated address
Michiel Broek <mbse@mbse.eu>
parents:
11
diff
changeset
|
4 | # Copyright (C) 2005-2012 |
5 | 5 | # |
6 | # Michiel Broek <mbse@mbse.eu> | |
7 | # the Netherlands | |
8 | # | |
14
59e07bba67cc
Fixed spelling error, updated address
Michiel Broek <mbse@mbse.eu>
parents:
11
diff
changeset
|
9 | # This file is part of SlackSecCheckScripts. |
5 | 10 | # |
11 | # This package is free software; you can redistribute it and/or modify it | |
12 | # under the terms of the GNU General Public License as published by the | |
13 | # Free Software Foundation; either version 2, or (at your option) any | |
14 | # later version. | |
15 | # | |
14
59e07bba67cc
Fixed spelling error, updated address
Michiel Broek <mbse@mbse.eu>
parents:
11
diff
changeset
|
16 | # SlackSecCheckScripts is distributed in the hope that it will be useful, but |
5 | 17 | # WITHOUT ANY WARRANTY; without even the implied warranty of |
18 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
19 | # General Public License for more details. | |
20 | # | |
21 | # You should have received a copy of the GNU General Public License | |
22 | # along with MBSE BBS; see the file COPYING. If not, write to the Free | |
23 | # Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. | |
24 | ############################################################################# | |
25 | ||
26 | PATH=/sbin:/usr/sbin:/bin:/usr/bin | |
27 | ||
28 | umask 077 | |
29 | TZ=UTC; export TZ | |
30 | LANG=C; export LANG | |
31 | ||
32 | SECUREDIR=`mktemp -d /tmp/_securedir.XXXXXX` || exit 1 | |
33 | ||
34 | trap "/bin/rm -rf $SECUREDIR ; exit 0" EXIT INT QUIT PIPE | |
35 | ||
36 | if ! cd "$SECUREDIR"; then | |
37 | echo "Can not cd to $SECUREDIR". | |
38 | exit 1 | |
39 | fi | |
40 | ||
41 | backup_dir=/var/cache/sscs | |
42 | mkdir -p "$backup_dir" | |
43 | ||
44 | CURR=${backup_dir}/setid.current | |
45 | BACK=${backup_dir}/setid.backup | |
46 | TMP1=$SECUREDIR/tmp1 | |
47 | TMP2=$SECUREDIR/tmp2 | |
48 | TMP3=$SECUREDIR/tmp3 | |
11 | 49 | FSS=$( egrep "^\/dev\/| tmpfs" /etc/mtab | awk '{ print $2 }' ) |
5 | 50 | |
51 | ||
52 | if [ ! -f $CURR ]; then | |
53 | # No database, install new database | |
54 | find $FSS \( -mount \( -perm -u+s -a ! -type d \) -o \( -perm -g+s -a ! -type d \) \) -print0 | \ | |
55 | xargs -0 /bin/ls -ld --full-time | sort -k9 > $CURR | |
56 | exit | |
57 | fi | |
58 | ||
59 | # Database is present, create temp database | |
60 | # | |
61 | find $FSS \( -mount \( -perm -u+s -a ! -type d \) -o \( -perm -g+s -a ! -type d \) \) -print0 | \ | |
62 | xargs -0 /bin/ls -ld --full-time | sort -k9 > $TMP1 | |
63 | changed=0 | |
64 | ||
65 | diff $TMP1 $CURR > $TMP2 | |
66 | if [ -s $TMP2 ]; then | |
67 | egrep '>' $TMP2 > $TMP3 | |
68 | if [ -s $TMP3 ]; then | |
69 | printf "\nOld or updated setuid or setgid files:\n" | |
70 | cat $TMP3 | tr '>' ' ' | |
71 | fi | |
72 | egrep '<' $TMP2 > $TMP3 | |
73 | if [ -s $TMP3 ]; then | |
74 | printf "\nNew or updated setuid or setgid files:\n" | |
75 | cat $TMP3 | tr '<' ' ' | |
76 | fi | |
77 | changed=1 | |
78 | fi | |
79 | ||
80 | ||
81 | # If changes were seen, update the database | |
82 | # | |
83 | if [ "$changed" == "1" ]; then | |
84 | cat $CURR > $BACK | |
85 | cat $TMP1 > $CURR | |
86 | fi | |
87 |