lynis/tests_file_permissions_ww

52 lines
1.7 KiB
Plaintext
Raw Normal View History

#!/bin/sh
#################################################################################
#
# Author: Thomas Biege <thomas@suse.de>
#
# Lynis comes with ABSOLUTELY NO WARRANTY. This is free software, and you are
# welcome to redistribute it under the terms of the GNU General Public License.
# See LICENSE file for usage of this software.
#
#################################################################################
#
# File permissions world-writeable file
#
#################################################################################
#
# TODO:
#
################################################################################
#
InsertSection "File systems"
#
#################################################################################
#
# Test : FILE-7527
# Description : Perform file permissions check
Register --test-no FILE-7527 --weight L --network NO --description "Lookup world-writeable files."
if [ ${SKIPTEST} -eq 0 ]; then
Display --indent 2 --text "- Starting file permissions check for world-writeable files..."
logtext "Test: Checking for world-writeable files"
TMP=$(mktemp /tmp/lynis.XXXXXX)
HPMAX=$FILE_NUM_TOTAL
HP=$HPMAX
find / -xdev \( -type f -o -type d -o -type s -o -type b -type p -o -type c \) -a -perm -0002 -print 2>/dev/null > $TMP
for i in $(cat $TMP)
do
HP=$((HP - 1))
Display --indent 4 --text "${i} is world-writeable" --result WARNING --color RED
done
# echo "AddHP $HP $HPMAX"
AddHP $HP $HPMAX
rm -f $TMP
fi
#
#################################################################################
#
wait_for_keypress
#
#================================================================================