Mon, 20 Jan 2014 12:48:38 +0100
Fixed error message when there was nothing to report.
5 | 1 | #!/bin/bash |
2 | # | |
3 | ############################################################################# | |
17
65656789da08
Removed uptime script, changed passwd test, minimized sensors output, bumped to version 0.18
Michiel Broek <mbroek@mbse.eu>
parents:
14
diff
changeset
|
4 | # Copyright (C) 2005-2013 |
5 | 5 | # |
17
65656789da08
Removed uptime script, changed passwd test, minimized sensors output, bumped to version 0.18
Michiel Broek <mbroek@mbse.eu>
parents:
14
diff
changeset
|
6 | # Michiel Broek <mbse at mbse.eu> |
5 | 7 | # |
14
59e07bba67cc
Fixed spelling error, updated address
Michiel Broek <mbse@mbse.eu>
parents:
11
diff
changeset
|
8 | # This file is part of SlackSecCheckScripts. |
5 | 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 | # | |
14
59e07bba67cc
Fixed spelling error, updated address
Michiel Broek <mbse@mbse.eu>
parents:
11
diff
changeset
|
15 | # SlackSecCheckScripts is distributed in the hope that it will be useful, but |
5 | 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 | ||
25 | PATH=/sbin:/usr/sbin:/bin:/usr/bin | |
26 | ||
27 | umask 077 | |
28 | TZ=UTC; export TZ | |
29 | LANG=C; export LANG | |
30 | ||
31 | SECUREDIR=`mktemp -d /tmp/_securedir.XXXXXX` || exit 1 | |
32 | ||
33 | trap "/bin/rm -rf $SECUREDIR ; exit 0" EXIT INT QUIT PIPE | |
34 | ||
35 | if ! cd "$SECUREDIR"; then | |
36 | echo "Can not cd to $SECUREDIR". | |
37 | exit 1 | |
38 | fi | |
39 | ||
40 | backup_dir=/var/cache/sscs | |
41 | mkdir -p "$backup_dir" | |
42 | ||
43 | CURR=${backup_dir}/setid.current | |
44 | BACK=${backup_dir}/setid.backup | |
45 | TMP1=$SECUREDIR/tmp1 | |
46 | TMP2=$SECUREDIR/tmp2 | |
47 | TMP3=$SECUREDIR/tmp3 | |
11 | 48 | FSS=$( egrep "^\/dev\/| tmpfs" /etc/mtab | awk '{ print $2 }' ) |
5 | 49 | |
50 | ||
51 | if [ ! -f $CURR ]; then | |
52 | # No database, install new database | |
53 | find $FSS \( -mount \( -perm -u+s -a ! -type d \) -o \( -perm -g+s -a ! -type d \) \) -print0 | \ | |
54 | xargs -0 /bin/ls -ld --full-time | sort -k9 > $CURR | |
55 | exit | |
56 | fi | |
57 | ||
58 | # Database is present, create temp database | |
59 | # | |
60 | find $FSS \( -mount \( -perm -u+s -a ! -type d \) -o \( -perm -g+s -a ! -type d \) \) -print0 | \ | |
61 | xargs -0 /bin/ls -ld --full-time | sort -k9 > $TMP1 | |
62 | changed=0 | |
63 | ||
64 | diff $TMP1 $CURR > $TMP2 | |
65 | if [ -s $TMP2 ]; then | |
66 | egrep '>' $TMP2 > $TMP3 | |
67 | if [ -s $TMP3 ]; then | |
68 | printf "\nOld or updated setuid or setgid files:\n" | |
69 | cat $TMP3 | tr '>' ' ' | |
70 | fi | |
71 | egrep '<' $TMP2 > $TMP3 | |
72 | if [ -s $TMP3 ]; then | |
73 | printf "\nNew or updated setuid or setgid files:\n" | |
74 | cat $TMP3 | tr '<' ' ' | |
75 | fi | |
76 | changed=1 | |
77 | fi | |
78 | ||
79 | ||
80 | # If changes were seen, update the database | |
81 | # | |
82 | if [ "$changed" == "1" ]; then | |
83 | cat $CURR > $BACK | |
84 | cat $TMP1 > $CURR | |
85 | fi | |
86 |