diff options
author | mboelen <michael@cisofy.com> | 2014-09-15 14:01:09 +0400 |
---|---|---|
committer | mboelen <michael@cisofy.com> | 2014-09-15 14:01:09 +0400 |
commit | c9fde8c2d11744cc0875bc3e5dd0abf096211755 (patch) | |
tree | 0997d08919db7ec4e2aa9065c3e9aaf1671c4d6f /include/tests_homedirs | |
parent | 35d32fb5e40b86632677fd2256aebeddf926394a (diff) |
Code cleanup and small enhancements
Diffstat (limited to 'include/tests_homedirs')
-rw-r--r-- | include/tests_homedirs | 67 |
1 files changed, 33 insertions, 34 deletions
diff --git a/include/tests_homedirs b/include/tests_homedirs index 0ec1cad1..4ee3e9b4 100644 --- a/include/tests_homedirs +++ b/include/tests_homedirs @@ -25,7 +25,6 @@ # Ignore some top level directories (not the sub directories below) IGNORE_HOME_DIRS="/bin /boot /cdrom /dev /etc /home /lib /lib64 /media /mnt /opt /proc /sbin /selinux /srv /sys /tmp /usr /var" - # ################################################################################# # @@ -34,18 +33,18 @@ # Description : Create list with home directories Register --test-no HOME-9302 --weight L --network NO --description "Create list with home directories" if [ ${SKIPTEST} -eq 0 ]; then - # Read sixth field of /etc/passwd - logtext "Test: query /etc/passwd to obtain home directories" + # Read sixth field of /etc/passwd + logtext "Test: query /etc/passwd to obtain home directories" FIND=`${AWKBINARY} -F: '{ if ($1 !~ "#") print $6 }' /etc/passwd | sort | uniq` - for I in ${FIND}; do - if [ -d ${I} ]; then - logtext "Result: found home directory: ${I} (directory exists)" - report "home_directory[]=${I}" - else - logtext "Result: found home directory: ${I} (directory does not exist)" - fi - done - fi + for I in ${FIND}; do + if [ -d ${I} ]; then + logtext "Result: found home directory: ${I} (directory exists)" + report "home_directory[]=${I}" + else + logtext "Result: found home directory: ${I} (directory does not exist)" + fi + done + fi # ################################################################################# # @@ -53,28 +52,28 @@ # Description : Check for suspicious shell history files Register --test-no HOME-9310 --weight L --network NO --description "Checking for suspicious shell history files" if [ ${SKIPTEST} -eq 0 ]; then - if [ ! "${HOMEDIRS}" = "" ]; then - if [ "${OS}" = "Solaris" ]; then - # Solaris doesn't support -maxdepth - FIND=`find ${HOMEDIRS} -name ".*history" -not -type f -print` - else - FIND=`find ${HOMEDIRS} -maxdepth 1 -name ".*history" -not -type f -print` - fi - if [ "${FIND}" = "" ]; then - Display --indent 2 --text "- Checking shell history files... " --result OK --color GREEN - logtext "Result: Ok, history files are type 'file'." - else - Display --indent 2 --text "- Checking shell history files... " --result WARNING --color RED - logtext "Result: the following files seem to be of the wrong file type:" - logtext "Output: ${FIND}" - logtext "Info: above files could be redirected files to avoid logging and should be investigated" - ReportWarning ${TEST_NO} "M" "Incorrect file type found for shell history file" - fi - logtext "Remarks: ${HOME_HISTORY_LOG_TEXT}" + if [ ! "${HOMEDIRS}" = "" ]; then + if [ "${OS}" = "Solaris" ]; then + # Solaris doesn't support -maxdepth + FIND=`find ${HOMEDIRS} -name ".*history" -not -type f -print` + else + FIND=`find ${HOMEDIRS} -maxdepth 1 -name ".*history" -not -type f -print` + fi + if [ "${FIND}" = "" ]; then + Display --indent 2 --text "- Checking shell history files" --result OK --color GREEN + logtext "Result: Ok, history files are type 'file'." + else + Display --indent 2 --text "- Checking shell history files" --result WARNING --color RED + logtext "Result: the following files seem to be of the wrong file type:" + logtext "Output: ${FIND}" + logtext "Info: above files could be redirected files to avoid logging and should be investigated" + ReportWarning ${TEST_NO} "M" "Incorrect file type found for shell history file" + fi + logtext "Remarks: ${HOME_HISTORY_LOG_TEXT}" else - Display --indent 2 --text "- Checking shell history files... " --result SKIPPED --color WHITE - logtext "Result: Homedirs is empty, test will be skipped" - fi + Display --indent 2 --text "- Checking shell history files" --result SKIPPED --color WHITE + logtext "Result: Homedirs is empty, test will be skipped" + fi fi # ################################################################################# @@ -103,7 +102,7 @@ fi #YYY - #echo -n " - Checking PATH variable vulnerabilities... " + #echo -n " - Checking PATH variable vulnerabilities" # #FIND=`find ${HOMEDIRS} -name * | grep -r 'PATH=' | egrep '=.:|:.:|:.;' | grep -v 'CDPATH'` #if [ "${FIND}" = "" ] |