#!/bin/sh

#################################################################################
#
#   Lynis
# ------------------
#
# Copyright 2007-2009, 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.
#
#################################################################################
#
    FILE_INT_TOOL_FOUND=0		# Boolean, file integrity tool found
#
#################################################################################
#
    InsertSection "Software: file integrity"

    # Test        : FINT-4310
    # Description : Check if AFICK is installed
    Register --test-no FINT-4310 --weight L --network NO --description "AFICK availability"
    if [ ${SKIPTEST} -eq 0 ]; then
	logtext "Test: Checking AFICK binary"
	if [ ! "${AFICKBINARY}" = "" ]; then
	    logtext "Result: AFICK is installed (${AFICKBINARY})"
	    FILE_INT_TOOL_FOUND=1
	    Display --indent 2 --text "- Checking AFICK..." --result FOUND --color GREEN
	  else	
	    logtext "Result: AFICK is not installed"
	    Display --indent 2 --text "- Checking AFICK..." --result "NOT FOUND" --color WHITE
	fi
    fi
#
#################################################################################
#
    # Test        : FINT-4314
    # Description : Check if AIDE is installed
    Register --test-no FINT-4314 --weight L --network NO --description "AIDE availability"
    if [ ${SKIPTEST} -eq 0 ]; then
	logtext "Test: Checking AIDE binary"
	if [ ! "${AIDEBINARY}" = "" ]; then
	    logtext "Result: AIDE is installed (${AIDEBINARY})"
	    FILE_INT_TOOL_FOUND=1
	    Display --indent 2 --text "- Checking AIDE..." --result FOUND --color GREEN
	  else	
	    logtext "Result: AIDE is not installed"
	    Display --indent 2 --text "- Checking AIDE..." --result "NOT FOUND" --color WHITE
	fi
    fi
#
#################################################################################
#
    # Test        : FINT-4318
    # Description : Check if Osiris is installed
    Register --test-no FINT-4318 --weight L --network NO --description "Osiris availability"
    if [ ${SKIPTEST} -eq 0 ]; then
	logtext "Test: Checking Osiris binary"
	if [ ! "${OSIRISBINARY}" = "" ]; then
	    logtext "Result: Osiris is installed (${OSIRISBINARY})"
	    FILE_INT_TOOL_FOUND=1
	    Display --indent 2 --text "- Checking Osiris..." --result FOUND --color GREEN
	  else	
	    logtext "Result: Osiris is not installed"
	    Display --indent 2 --text "- Checking Osiris..." --result "NOT FOUND" --color WHITE
	fi
    fi
#
#################################################################################
#
    # Test        : FINT-4322
    # Description : Check if Samhain is installed
    Register --test-no FINT-4322 --weight L --network NO --description "Samhain availability"
    if [ ${SKIPTEST} -eq 0 ]; then
	logtext "Test: Checking Samhain binary"
	if [ ! "${SAMHAINBINARY}" = "" ]; then
	    logtext "Result: Samhain is installed (${SAMHAINBINARY})"
	    FILE_INT_TOOL_FOUND=1
	    Display --indent 2 --text "- Checking Samhain..." --result FOUND --color GREEN
	  else	
	    logtext "Result: Samhain is not installed"
	    Display --indent 2 --text "- Checking Samhain..." --result "NOT FOUND" --color WHITE
	fi
    fi
#
#################################################################################
#
    # Test        : FINT-4326
    # Description : Check if Tripwire is installed
    Register --test-no FINT-4326 --weight L --network NO --description "Tripwire availability"
    if [ ${SKIPTEST} -eq 0 ]; then
	logtext "Test: Checking Tripwire binary"
	if [ ! "${TRIPWIREBINARY}" = "" ]; then
	    logtext "Result: Tripwire is installed (${TRIPWIREBINARY})"
	    FILE_INT_TOOL_FOUND=1
	    Display --indent 2 --text "- Checking Tripwire..." --result FOUND --color GREEN
	  else	
	    logtext "Result: Tripwire is not installed"
	    Display --indent 2 --text "- Checking Tripwire..." --result "NOT FOUND" --color WHITE
	fi
    fi
#
#################################################################################
#
    # Test        : FINT-4350
    # Description : Check if at least one file integrity tool is installed
    Register --test-no FINT-4350 --weight L --network NO --description "File integrity software installed"
    if [ ${SKIPTEST} -eq 0 ]; then
        logtext "Test: Check if at least on file integrity tool is available/installed"
	if [ ${FILE_INT_TOOL_FOUND} -eq 1 ]; then
	    logtext "Result: found at least one tool"
	    Display --indent 2 --text "- Checking presence integrity tool..." --result FOUND --color GREEN
	    AddHP 5 5
	  else
	    logtext "Result: No file integrity tools found"
	    Display --indent 2 --text "- Checking presence integrity tool..." --result "NOT FOUND" --color YELLOW
	    AddHP 0 5
	fi
    fi
#
#################################################################################
#
    wait_for_keypress
        
#
#================================================================================
# Lynis - Copyright 2007-2009, Michael Boelen - www.rootkit.nl - The Netherlands
