security.d/chk_setid

changeset 20
1d18ebb9e279
parent 17
65656789da08
child 21
735fe1b89e5a
equal deleted inserted replaced
19:2c0dacb26b14 20:1d18ebb9e279
1 #!/bin/bash 1 #!/bin/bash
2 # 2 #
3 ############################################################################# 3 #############################################################################
4 # Copyright (C) 2005-2013 4 # Copyright (C) 2005-2014
5 # 5 #
6 # Michiel Broek <mbse at mbse.eu> 6 # Michiel Broek <mbse at mbse.eu>
7 # 7 #
8 # This file is part of SlackSecCheckScripts. 8 # This file is part of SlackSecCheckScripts.
9 # 9 #
26 26
27 umask 077 27 umask 077
28 TZ=UTC; export TZ 28 TZ=UTC; export TZ
29 LANG=C; export LANG 29 LANG=C; export LANG
30 30
31 SECUREDIR=`mktemp -d /tmp/_securedir.XXXXXX` || exit 1 31 SECUREDIR=$(mktemp -d /tmp/_securedir.XXXXXX) || exit 1
32 32
33 trap "/bin/rm -rf $SECUREDIR ; exit 0" EXIT INT QUIT PIPE 33 trap "/bin/rm -rf $SECUREDIR ; exit 0" EXIT INT QUIT PIPE
34 34
35 if ! cd "$SECUREDIR"; then 35 if ! cd "$SECUREDIR"; then
36 echo "Can not cd to $SECUREDIR". 36 echo "Can not cd to $SECUREDIR".
48 FSS=$( egrep "^\/dev\/| tmpfs" /etc/mtab | awk '{ print $2 }' ) 48 FSS=$( egrep "^\/dev\/| tmpfs" /etc/mtab | awk '{ print $2 }' )
49 49
50 50
51 if [ ! -f $CURR ]; then 51 if [ ! -f $CURR ]; then
52 # No database, install new database 52 # No database, install new database
53 find $FSS \( -mount \( -perm -u+s -a ! -type d \) -o \( -perm -g+s -a ! -type d \) \) -print0 | \ 53 find $FSS \( -mount \( -perm -u+s -a ! -type d \) -o \( -perm -g+s -a ! -type d \) \) -print0 2>/dev/null | \
54 xargs -0 /bin/ls -ld --full-time | sort -k9 > $CURR 54 xargs -0 /bin/ls -ld --full-time | sort -k9 > $CURR
55 exit 55 exit
56 fi 56 fi
57 57
58 # Database is present, create temp database 58 # Database is present, create temp database
59 # 59 #
60 find $FSS \( -mount \( -perm -u+s -a ! -type d \) -o \( -perm -g+s -a ! -type d \) \) -print0 | \ 60 find $FSS \( -mount \( -perm -u+s -a ! -type d \) -o \( -perm -g+s -a ! -type d \) \) -print0 2>/dev/null | \
61 xargs -0 /bin/ls -ld --full-time | sort -k9 > $TMP1 61 xargs -0 /bin/ls -ld --full-time | sort -k9 > $TMP1
62 changed=0 62 changed=0
63 63
64 diff $TMP1 $CURR > $TMP2 64 diff $TMP1 $CURR > $TMP2
65 if [ -s $TMP2 ]; then 65 if [ -s $TMP2 ]; then

mercurial