#!/bin/sh

#################################################################################
#
#   Lynis
# ------------------
#
# Copyright 2007-2008, Michael Boelen (michael@rootkit.nl), The Netherlands
# Web site: http://www.rootkit.nl
#
# 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.
#
#################################################################################
#
# Home directories
#
#################################################################################
#
    InsertSection "Home directories"
#
#################################################################################
#

#YYY check home directories

#Display all (unique) home directories
#FIND=`awk -F: '{ if ( $1 !~ "#" ) print $6 }' /etc/passwd | sort | uniq`

# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

logtext "Test: ${HOME_HISTORY_LOG_TITLE}"
logtext "Description: ${HOME_HISTORY_LOG_DESCRIPTION}"
counttests

if [ ! "${HOMEDIRS}" = "" ]; then
    FIND=`find ${HOMEDIRS} -name ".*history" -not -type f -print`
    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 "Warning: the following files seem to be of the wrong file type:"
        logtext "Output: ${FIND}"
	report "warning[]=Found incorrect file type while checking shell history files"
    fi
    logtext "Remarks: ${HOME_HISTORY_LOG_TEXT}"
  else
    Display --indent 2 --text "- Checking shell history files... " --result SKIPPED --color WHITE
    logtext "Homedirs is empty, test will be skipped"
fi

logtextbreak

# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

#counttests
#
#echo -n "      - Checking PATH variable vulnerabilities... "
#
#FIND=`find ${HOMEDIRS} -name * | grep -r 'PATH=' | egrep '=.:|:.:|:.;' | grep -v 'CDPATH'`
#if [ "${FIND}" = "" ]
#  then
#    ShowResult OK
#    logtext "Result: Ok, no special things found in the PATH variable"
#  else
#    echo "[ ${WARNING}WARNING${NORMAL} ]"
#    logtext "Warning: Probably found \".\" in the PATH. Details: ${FIND}"
#fi
#
#logtextbreak

# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-


#
#================================================================================
# Lynis - Copyright 2007-2008, Michael Boelen - www.rootkit.nl - The Netherlands
