diff options
author | mboelen <michael@cisofy.com> | 2014-08-26 19:33:55 +0400 |
---|---|---|
committer | mboelen <michael@cisofy.com> | 2014-08-26 19:33:55 +0400 |
commit | c0ae2e217b7f1fb0171017ce5afb8eb8898470db (patch) | |
tree | 545aa150c35c5fb74d7bb4c2d3b0ae41cfa7b4e5 /include/tests_insecure_services |
Initial import
Diffstat (limited to 'include/tests_insecure_services')
-rw-r--r-- | include/tests_insecure_services | 117 |
1 files changed, 117 insertions, 0 deletions
diff --git a/include/tests_insecure_services b/include/tests_insecure_services new file mode 100644 index 00000000..8beb913f --- /dev/null +++ b/include/tests_insecure_services @@ -0,0 +1,117 @@ +#!/bin/sh + +################################################################################# +# +# Lynis +# ------------------ +# +# Copyright 2007-2014, 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. +# +################################################################################# +# +# Unsecure services +# +################################################################################# +# + InsertSection "Insecure services" +# +################################################################################# +# + INETD_ACTIVE=0 + INETD_CONFIG_FILE="/etc/inetd.conf" +# +################################################################################# +# + # Test : INSE-8002 + # Description : Check for inetd status + Register --test-no INSE-8002 --weight L --network NO --description "Check for enabled inet daemon" + if [ ${SKIPTEST} -eq 0 ]; then + # Check running processes + logtext "Test: Searching for active inet daemon..." + FIND=`${PSBINARY} ax | grep "inetd" | grep -v "grep"` + if [ ! "${FIND}" = "" ]; then + logtext "Result: inetd is running" + Display --indent 2 --text "- Checking inetd status..." --result ACTIVE --color GREEN + #YYY perform manual check + INETD_ACTIVE=1 + else + logtext "Result: inetd is NOT running" + Display --indent 2 --text "- Checking inetd status..." --result "NOT ACTIVE" --color GREEN + fi + fi +# +################################################################################# +# + # Test : INSE-8004 + # Description : Check for inetd configuration file + if [ ${INETD_ACTIVE} -eq 1 ]; then PREQS_MET="YES"; else PREQS_MET="NO"; fi + Register --test-no INSE-8004 --preqs-met ${PREQS_MET} --weight L --network NO --description "Check for enabled inet daemon" + if [ ${SKIPTEST} -eq 0 ]; then + # Check configuration file + logtext "Test: Searching for file ${INETD_CONFIG_FILE}..." + if [ -f ${INETD_CONFIG_FILE} ]; then + logtext "Result: ${INETD_CONFIG_FILE} exists" + Display --indent 4 --text "- Checking inetd.conf..." --result FOUND --color WHITE + else + logtext "Result: ${INETD_CONFIG_FILE} does not exist" + Display --indent 4 --text "- Checking inetd.conf..." --result "NOT FOUND" --color WHITE + fi + # YYY immutable bit could be set + # YYY permission check (already set in profile) + fi +# +################################################################################# +# + # Test : INSE-8006 + # Description : Check for inetd configuration file contents if inetd is NOT active + if [ ${INETD_ACTIVE} -eq 0 -a -f ${INETD_CONFIG_FILE} ]; then PREQS_MET="YES"; else PREQS_MET="NO"; fi + Register --test-no INSE-8006 --preqs-met ${PREQS_MET} --weight L --network NO --description "Check for disabled inet daemon" + if [ ${SKIPTEST} -eq 0 ]; then + # Check if any service is enabled in /etc/inetd.conf (inetd is not active, see test 8002) + logtext "Test: check if all services are disabled if inetd is disabled" + FIND=`cat ${INETD_CONFIG_FILE} | grep -v "^#" | grep -v "^$"` + if [ "${FIND}" = "" ]; then + Display --indent 4 --text "- Checking inetd.conf services..." --result OK --color GREEN + else + Display --indent 4 --text "- Checking inetd.conf services..." --result SUGGESTION --color YELLOW + ReportSuggestion ${TEST_NO} "Although inetd is not running, make sure no services are enabled in ${INETD_CONFIG_FILE}" + fi + fi +# +################################################################################# +# + # Test : INSE-8016 + # Description : Check for telnet enabled via inetd + if [ ${INETD_ACTIVE} -eq 1 -a -f ${INETD_CONFIG_FILE} ]; then PREQS_MET="YES"; else PREQS_MET="NO"; fi + Register --test-no INSE-8016 --preqs-met ${PREQS_MET} --weight L --network NO --description "Check for telnet via inetd" + if [ ${SKIPTEST} -eq 0 ]; then + logtext "Test: checking telnet presence in inetd configuration" + FIND=`grep "^telnet" ${INETD_CONFIG_FILE}` + if [ "${FIND}" = "" ]; then + logtext "Result: telnet not enabled in ${INETD_CONFIG_FILE}" + Display --indent 2 --text "- Checking inetd (telnet)..." --result FOUND --color GREEN + else + logtext "Result: telnet enabled in ${INETD_CONFIG_FILE}" + Display --indent 2 --text "- Checking inetd (telnet)..." --result WARNING --color RED + fi + fi +# +################################################################################# +# +# Check telnet in /etc/xinetd.conf +# Check telnet in /etc/xinetd/* +# Check running telnet daemon (telnetd) +# rshd rlogin rexec +# /etc/hosts.equiv + + +wait_for_keypress + +# +#================================================================================ +# Lynis - Copyright 2007-2014, Michael Boelen - www.rootkit.nl - The Netherlands |