2014-08-26 17:33:55 +02:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
#################################################################################
|
|
|
|
#
|
|
|
|
# Lynis
|
|
|
|
# ------------------
|
|
|
|
#
|
2016-03-13 16:00:39 +01:00
|
|
|
# Copyright 2007-2013, Michael Boelen
|
|
|
|
# Copyright 2013-2016, CISOfy
|
|
|
|
#
|
|
|
|
# Website : https://cisofy.com
|
|
|
|
# Blog : http://linux-audit.com
|
|
|
|
# GitHub : https://github.com/CISOfy/lynis
|
2014-08-26 17:33:55 +02:00
|
|
|
#
|
|
|
|
# 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.
|
|
|
|
#
|
|
|
|
#################################################################################
|
|
|
|
#
|
|
|
|
# Squid
|
|
|
|
#
|
|
|
|
#################################################################################
|
|
|
|
#
|
|
|
|
SQUID_DAEMON_CONFIG_LOCS="/etc /etc/squid /etc/squid3 /usr/local/etc/squid /usr/local/squid/etc"
|
|
|
|
SQUID_DAEMON_CONFIG=""
|
|
|
|
SQUID_DAEMON_UNSAFE_PORTS_LIST="22 23 25"
|
|
|
|
SQUID_DAEMON_RUNNING=0
|
|
|
|
#
|
|
|
|
#################################################################################
|
|
|
|
#
|
|
|
|
InsertSection "Squid Support"
|
|
|
|
#
|
|
|
|
#################################################################################
|
|
|
|
#
|
|
|
|
# Test : SQD-3602
|
|
|
|
# Description : Check for a running Squid daemon
|
|
|
|
# Notes : Search for squid(3) with a space, to avoid SquidGuard and other
|
|
|
|
# programs.
|
2016-07-24 17:22:00 +02:00
|
|
|
Register --test-no SQD-3602 --weight L --network NO --category security --description "Check for running Squid daemon"
|
2014-08-26 17:33:55 +02:00
|
|
|
if [ ${SKIPTEST} -eq 0 ]; then
|
2015-12-21 21:17:15 +01:00
|
|
|
LogText "Test: Searching for a Squid daemon"
|
2014-08-26 17:33:55 +02:00
|
|
|
FOUND=0
|
|
|
|
# Check running processes
|
2016-08-25 15:31:33 +02:00
|
|
|
FIND=`${PSBINARY} ax | ${EGREPBINARY} "(squid|squid3) " | ${GREPBINARY} -v "grep"`
|
2014-08-26 17:33:55 +02:00
|
|
|
if [ ! "${FIND}" = "" ]; then
|
|
|
|
SQUID_DAEMON_RUNNING=1
|
2015-12-21 21:17:15 +01:00
|
|
|
LogText "Result: Squid daemon is running"
|
2016-06-18 11:14:01 +02:00
|
|
|
Display --indent 2 --text "- Checking running Squid daemon" --result "${STATUS_FOUND}" --color GREEN
|
2014-08-26 17:33:55 +02:00
|
|
|
else
|
2015-12-21 21:17:15 +01:00
|
|
|
LogText "Result: No running Squid daemon found"
|
2016-06-18 11:14:01 +02:00
|
|
|
Display --indent 2 --text "- Checking running Squid daemon" --result "${STATUS_NOT_FOUND}" --color WHITE
|
2014-08-26 17:33:55 +02:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
#
|
|
|
|
#################################################################################
|
|
|
|
#
|
|
|
|
# Test : SQD-3604
|
|
|
|
# Description : Determine Squid daemon configuration file location
|
|
|
|
if [ ${SQUID_DAEMON_RUNNING} -eq 1 ]; then PREQS_MET="YES"; else PREQS_MET="NO"; fi
|
2016-07-24 17:22:00 +02:00
|
|
|
Register --test-no SQD-3604 --preqs-met ${PREQS_MET} --weight L --network NO --category security --description "Check Squid daemon file location"
|
2014-08-26 17:33:55 +02:00
|
|
|
if [ ${SKIPTEST} -eq 0 ]; then
|
2015-12-21 21:17:15 +01:00
|
|
|
LogText "Test: searching for squid.conf or squid3.conf file"
|
2014-08-26 17:33:55 +02:00
|
|
|
for I in ${SQUID_DAEMON_CONFIG_LOCS}; do
|
|
|
|
# Checking squid.conf
|
|
|
|
if [ -f "${I}/squid.conf" ]; then
|
2015-12-21 21:17:15 +01:00
|
|
|
LogText "Result: ${I}/squid.conf exists"
|
2014-08-26 17:33:55 +02:00
|
|
|
SQUID_DAEMON_CONFIG="${I}/squid.conf"
|
|
|
|
fi
|
|
|
|
# Checking squid3.conf
|
|
|
|
if [ -f "${I}/squid3.conf" ]; then
|
2015-12-21 21:17:15 +01:00
|
|
|
LogText "Result: ${I}/squid3.conf exists"
|
2014-08-26 17:33:55 +02:00
|
|
|
SQUID_DAEMON_CONFIG="${I}/squid3.conf"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
if [ "${SQUID_DAEMON_CONFIG}" = "" ]; then
|
2015-12-21 21:17:15 +01:00
|
|
|
LogText "Result: No Squid configuration file found"
|
2016-06-18 11:14:01 +02:00
|
|
|
Display --indent 4 --text "- Searching Squid configuration file" --result "${STATUS_NOT_FOUND}" --color YELLOW
|
2014-08-26 17:33:55 +02:00
|
|
|
else
|
2015-12-21 21:17:15 +01:00
|
|
|
LogText "Result: using last found configuration file: ${SQUID_DAEMON_CONFIG}"
|
2016-06-18 11:14:01 +02:00
|
|
|
Display --indent 4 --text "- Searching Squid configuration" --result "${STATUS_FOUND}" --color GREEN
|
2014-08-26 17:33:55 +02:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
#
|
|
|
|
#################################################################################
|
|
|
|
#
|
|
|
|
# Test : SQD-3606
|
|
|
|
# Description : Check Squid version
|
|
|
|
if [ ${SQUID_DAEMON_RUNNING} -eq 1 -a ! "${SQUID_DAEMON_CONFIG}" = "" ]; then PREQS_MET="YES"; else PREQS_MET="NO"; fi
|
2016-07-24 17:22:00 +02:00
|
|
|
Register --test-no SQD-3606 --preqs-met ${PREQS_MET} --weight L --network NO --category security --description "Check Squid version"
|
2014-08-26 17:33:55 +02:00
|
|
|
if [ ${SKIPTEST} -eq 0 ]; then
|
2014-09-15 12:01:09 +02:00
|
|
|
if [ ! "${SQUIDBINARY}" = "" ]; then
|
2015-12-21 21:17:15 +01:00
|
|
|
LogText "Result: Squid binary found (${SQUIDBINARY})"
|
2014-09-15 12:01:09 +02:00
|
|
|
# Skip check if a setuid/setgid bit is found
|
|
|
|
FIND=`find ${SQUIDBINARY} \( -perm 4000 -o -perm 2000 \) -print`
|
|
|
|
if [ "${FIND}" = "" ]; then
|
2016-08-25 15:31:33 +02:00
|
|
|
FIND2=`${SQUIDBINARY} -v | ${AWKBINARY} '{ if ($3=="Version") { print $4 } }'`
|
2016-06-18 11:14:01 +02:00
|
|
|
Display --indent 4 --text "- Checking Squid version" --result "${STATUS_FOUND}" --color GREEN
|
2014-09-15 12:01:09 +02:00
|
|
|
SQUID_VERSION="${FIND2}"
|
|
|
|
else
|
2015-12-21 21:17:15 +01:00
|
|
|
LogText "Result: test skipped for security reasons, setuid/setgid bit set"
|
2016-06-18 11:14:01 +02:00
|
|
|
Display --indent 4 --text "- Checking Squid version" --result "${STATUS_SKIPPED}" --color RED
|
2014-09-15 12:01:09 +02:00
|
|
|
fi
|
|
|
|
else
|
2015-12-21 21:17:15 +01:00
|
|
|
LogText "Result: no Squid binary found"
|
2014-09-15 12:01:09 +02:00
|
|
|
fi
|
2014-08-26 17:33:55 +02:00
|
|
|
fi
|
|
|
|
#
|
|
|
|
#################################################################################
|
|
|
|
#
|
|
|
|
# Test : SQD-3610
|
|
|
|
# Description : Check Squid configuration options
|
|
|
|
if [ ${SQUID_DAEMON_RUNNING} -eq 1 -a ! "${SQUID_DAEMON_CONFIG}" = "" ]; then PREQS_MET="YES"; else PREQS_MET="NO"; fi
|
2016-07-24 17:22:00 +02:00
|
|
|
Register --test-no SQD-3610 --preqs-met ${PREQS_MET} --weight L --network NO --category security --description "Check Squid version"
|
2014-08-26 17:33:55 +02:00
|
|
|
if [ ${SKIPTEST} -eq 0 ]; then
|
2015-12-21 21:17:15 +01:00
|
|
|
LogText "Test: Checking all specific defined options in ${SQUID_DAEMON_CONFIG}"
|
2016-09-08 21:04:17 +02:00
|
|
|
FIND=`${GREPBINARY} -v "^#" ${SQUID_DAEMON_CONFIG} | ${GREPBINARY} -v "^$" | ${AWKBINARY} '{gsub("\t"," ");print}' | ${SEDBINARY} 's/ /!space!/g'`
|
2014-09-15 12:01:09 +02:00
|
|
|
for I in ${FIND}; do
|
2016-09-08 21:04:17 +02:00
|
|
|
I=`echo ${I} | ${SEDBINARY} 's/!space!/ /g'`
|
2015-12-21 21:17:15 +01:00
|
|
|
LogText "Found Squid option: ${I}"
|
|
|
|
Report "squid_option=${I}"
|
2014-09-15 12:01:09 +02:00
|
|
|
done
|
2016-06-18 11:14:01 +02:00
|
|
|
Display --indent 4 --text "- Checking defined Squid options" --result "${STATUS_DONE}" --color GREEN
|
2014-08-26 17:33:55 +02:00
|
|
|
fi
|
|
|
|
#
|
|
|
|
#################################################################################
|
|
|
|
#
|
|
|
|
# Test : SQD-3613
|
|
|
|
# Description : Check Squid configuration options
|
|
|
|
if [ ${SQUID_DAEMON_RUNNING} -eq 1 -a ! "${SQUID_DAEMON_CONFIG}" = "" ]; then PREQS_MET="YES"; else PREQS_MET="NO"; fi
|
2016-07-24 17:22:00 +02:00
|
|
|
Register --test-no SQD-3613 --preqs-met ${PREQS_MET} --weight L --network NO --category security --description "Check Squid file permissions"
|
2014-08-26 17:33:55 +02:00
|
|
|
if [ ${SKIPTEST} -eq 0 ]; then
|
2015-12-21 21:17:15 +01:00
|
|
|
LogText "Test: Checking file permissions of ${SQUID_DAEMON_CONFIG}"
|
2014-08-26 17:33:55 +02:00
|
|
|
FIND=`find ${SQUID_DAEMON_CONFIG} -type f -a \( -perm -004 -o -perm -002 -o -perm -001 \)`
|
|
|
|
if [ ! "${FIND}" = "" ]; then
|
2015-12-21 21:17:15 +01:00
|
|
|
LogText "Result: file ${SQUID_DAEMON_CONFIG} is world readable, writable or executable and could leak information or passwords"
|
2016-06-18 11:14:01 +02:00
|
|
|
Display --indent 4 --text "- Checking Squid configuration file permissions" --result "${STATUS_WARNING}" --color RED
|
2014-08-26 17:33:55 +02:00
|
|
|
ReportSuggestion ${TEST_NO} "Check file permissions of ${SQUID_DAEMON_CONFIG} to limit access"
|
2016-08-10 07:13:10 +02:00
|
|
|
ReportWarning ${TEST_NO} "File permissions of ${SQUID_DAEMON_CONFIG} are not restrictive"
|
2014-08-26 17:33:55 +02:00
|
|
|
AddHP 0 2
|
|
|
|
else
|
2015-12-21 21:17:15 +01:00
|
|
|
LogText "Result: file ${SQUID_DAEMON_CONFIG} has proper file permissions"
|
2016-06-18 11:14:01 +02:00
|
|
|
Display --indent 4 --text "- Checking Squid configuration file permissions" --result "${STATUS_OK}" --color GREEN
|
2014-08-26 17:33:55 +02:00
|
|
|
AddHP 2 2
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
#
|
|
|
|
#################################################################################
|
|
|
|
#
|
|
|
|
if [ ${SQUID_DAEMON_RUNNING} -eq 1 -a ! "${SQUID_DAEMON_CONFIG}" = "" ]; then
|
2014-09-15 12:01:09 +02:00
|
|
|
Display --indent 4 --text "- Checking Squid access control"
|
2014-08-26 17:33:55 +02:00
|
|
|
fi
|
|
|
|
#
|
|
|
|
#################################################################################
|
|
|
|
#
|
|
|
|
# Test : SQD-3614
|
|
|
|
# Description : Check Squid authentication
|
|
|
|
if [ ${SQUID_DAEMON_RUNNING} -eq 1 -a ! "${SQUID_DAEMON_CONFIG}" = "" ]; then PREQS_MET="YES"; else PREQS_MET="NO"; fi
|
2016-07-24 17:22:00 +02:00
|
|
|
Register --test-no SQD-3614 --preqs-met ${PREQS_MET} --weight L --network NO --category security --description "Check Squid authentication methods"
|
2014-08-26 17:33:55 +02:00
|
|
|
if [ ${SKIPTEST} -eq 0 ]; then
|
2015-12-21 21:17:15 +01:00
|
|
|
LogText "Test: check auth_param option for authentication methods"
|
2016-08-25 15:31:33 +02:00
|
|
|
FIND=`${GREPBINARY} "^auth_param" ${SQUID_DAEMON_CONFIG} | ${AWKBINARY} '{ print $2 }'`
|
2014-09-15 12:01:09 +02:00
|
|
|
if [ "${FIND}" = "" ]; then
|
2015-12-21 21:17:15 +01:00
|
|
|
LogText "No auth_param option found, proxy access anonymous or based on other methods (like ACLs)"
|
2016-06-18 11:14:01 +02:00
|
|
|
Display --indent 6 --text "- Checking Squid authentication methods" --result "${STATUS_NONE}" --color YELLOW
|
2014-09-15 12:01:09 +02:00
|
|
|
else
|
2016-06-18 11:14:01 +02:00
|
|
|
Display --indent 6 --text "- Checking Squid authentication methods" --result "${STATUS_FOUND}" --color GREEN
|
2014-09-15 12:01:09 +02:00
|
|
|
for I in ${FIND}; do
|
2015-12-21 21:17:15 +01:00
|
|
|
LogText "Result: found authentication method ${I}"
|
|
|
|
Report "squid_auth_method=${I}"
|
2014-09-15 12:01:09 +02:00
|
|
|
done
|
|
|
|
fi
|
2014-08-26 17:33:55 +02:00
|
|
|
fi
|
|
|
|
#
|
|
|
|
#################################################################################
|
|
|
|
#
|
|
|
|
# Test : SQD-3616
|
|
|
|
# Description : Check external Squid authentication
|
|
|
|
if [ ${SQUID_DAEMON_RUNNING} -eq 1 -a ! "${SQUID_DAEMON_CONFIG}" = "" ]; then PREQS_MET="YES"; else PREQS_MET="NO"; fi
|
2016-07-24 17:22:00 +02:00
|
|
|
Register --test-no SQD-3616 --preqs-met ${PREQS_MET} --weight L --network NO --category security --description "Check external Squid authentication"
|
2014-08-26 17:33:55 +02:00
|
|
|
if [ ${SKIPTEST} -eq 0 ]; then
|
2015-12-21 21:17:15 +01:00
|
|
|
LogText "Test: check external_acl_type option for external authentication helpers"
|
2016-08-25 15:31:33 +02:00
|
|
|
FIND=`${GREPBINARY} "^external_acl_type" ${SQUID_DAEMON_CONFIG}`
|
2014-09-15 12:01:09 +02:00
|
|
|
if [ "${FIND}" = "" ]; then
|
2015-12-21 21:17:15 +01:00
|
|
|
LogText "No external_acl_type found"
|
2016-06-18 11:14:01 +02:00
|
|
|
Display --indent 6 --text "- Checking Squid external authentication methods" --result "${STATUS_NONE}" --color YELLOW
|
2014-09-15 12:01:09 +02:00
|
|
|
else
|
2016-06-18 11:14:01 +02:00
|
|
|
Display --indent 6 --text "- Checking Squid external authentication methods" --result "${STATUS_FOUND}" --color GREEN
|
2014-09-15 12:01:09 +02:00
|
|
|
for I in ${FIND}; do
|
2015-12-21 21:17:15 +01:00
|
|
|
LogText "Result: found external authentication method helper"
|
|
|
|
LogText "Output: ${FIND}"
|
|
|
|
#Report "squid_external_acl_type=TRUE"
|
2014-09-15 12:01:09 +02:00
|
|
|
done
|
|
|
|
fi
|
2014-08-26 17:33:55 +02:00
|
|
|
fi
|
|
|
|
#
|
|
|
|
#################################################################################
|
|
|
|
#
|
|
|
|
# Test : SQD-3620
|
|
|
|
# Description : Check ACLs
|
|
|
|
if [ ${SQUID_DAEMON_RUNNING} -eq 1 -a ! "${SQUID_DAEMON_CONFIG}" = "" ]; then PREQS_MET="YES"; else PREQS_MET="NO"; fi
|
2016-07-24 17:22:00 +02:00
|
|
|
Register --test-no SQD-3620 --preqs-met ${PREQS_MET} --weight L --network NO --category security --description "Check Squid access control lists"
|
2014-08-26 17:33:55 +02:00
|
|
|
if [ ${SKIPTEST} -eq 0 ]; then
|
2014-09-15 12:01:09 +02:00
|
|
|
N=0
|
2015-12-21 21:17:15 +01:00
|
|
|
LogText "Test: checking ACLs"
|
2016-09-08 21:04:17 +02:00
|
|
|
FIND=`${GREPBINARY} "^acl " ${SQUID_DAEMON_CONFIG} | ${SEDBINARY} 's/ /!space!/g'`
|
2014-09-15 12:01:09 +02:00
|
|
|
if [ "${FIND}" = "" ]; then
|
2015-12-21 21:17:15 +01:00
|
|
|
LogText "Result: No ACLs found"
|
2016-06-18 11:14:01 +02:00
|
|
|
Display --indent 6 --text "- Checking Access Control Lists" --result "${STATUS_NONE}" --color RED
|
2014-09-15 12:01:09 +02:00
|
|
|
else
|
|
|
|
for I in ${FIND}; do
|
2016-05-03 14:57:53 +02:00
|
|
|
N=$((N + 1))
|
2016-09-08 21:04:17 +02:00
|
|
|
I=`echo ${I} | ${SEDBINARY} 's/!space!/ /g'`
|
2015-12-21 21:17:15 +01:00
|
|
|
LogText "Found ACL: ${I}"
|
|
|
|
#Report "squid_acl=${I}"
|
2014-09-15 12:01:09 +02:00
|
|
|
done
|
2015-12-21 21:17:15 +01:00
|
|
|
LogText "Result: Found ${N} ACLs"
|
2014-09-15 12:01:09 +02:00
|
|
|
Display --indent 6 --text "- Checking Access Control Lists" --result "${N} ACLs FOUND" --color GREEN
|
|
|
|
fi
|
2014-08-26 17:33:55 +02:00
|
|
|
fi
|
|
|
|
#
|
|
|
|
#################################################################################
|
|
|
|
#
|
|
|
|
# Test : SQD-3624 [T]
|
|
|
|
# Description : Check unsecure ports in Safe_ports list
|
|
|
|
if [ ${SQUID_DAEMON_RUNNING} -eq 1 -a ! "${SQUID_DAEMON_CONFIG}" = "" ]; then PREQS_MET="YES"; else PREQS_MET="NO"; fi
|
2016-07-24 17:22:00 +02:00
|
|
|
Register --test-no SQD-3624 --preqs-met ${PREQS_MET} --weight L --network NO --category security --description "Check Squid safe ports"
|
2014-08-26 17:33:55 +02:00
|
|
|
if [ ${SKIPTEST} -eq 0 ]; then
|
2014-09-15 12:01:09 +02:00
|
|
|
N=0
|
2015-12-21 21:17:15 +01:00
|
|
|
LogText "Test: checking ACL Safe_ports http_access option"
|
2016-08-25 15:31:33 +02:00
|
|
|
FIND=`${GREPBINARY} "^http_access" ${SQUID_DAEMON_CONFIG} | ${GREPBINARY} "Safe_ports"`
|
2014-09-15 12:01:09 +02:00
|
|
|
if [ "${FIND}" = "" ]; then
|
2015-12-21 21:17:15 +01:00
|
|
|
LogText "Result: no Safe_ports found"
|
2016-06-18 11:14:01 +02:00
|
|
|
Display --indent 6 --text "- Checking ACL 'Safe_ports' http_access option" --result "${STATUS_NOT_FOUND}" --color YELLOW
|
2014-09-15 12:01:09 +02:00
|
|
|
ReportSuggestion ${TEST_NO} "Check if Squid has been configured to restrict access to all safe ports"
|
|
|
|
else
|
2015-12-21 21:17:15 +01:00
|
|
|
LogText "Result: checking ACL safe ports"
|
2016-08-25 15:31:33 +02:00
|
|
|
FIND2=`${GREPBINARY} "^acl Safe_ports port" ${SQUID_DAEMON_CONFIG} | ${AWKBINARY} '{ print $4 }'`
|
2014-09-15 12:01:09 +02:00
|
|
|
if [ "${FIND2}" = "" ]; then
|
|
|
|
Display --indent 6 --text "- Checking ACL 'Safe_ports' ports" --result "NONE FOUND" --color YELLOW
|
|
|
|
ReportSuggestion ${TEST_NO} "Check if Squid has been configured for which ports it can allow outgoing traffic (Safe_ports)"
|
|
|
|
AddHP 0 1
|
|
|
|
else
|
2015-12-21 21:17:15 +01:00
|
|
|
LogText "Result: Safe_ports found"
|
2014-09-15 12:01:09 +02:00
|
|
|
for I in ${FIND}; do
|
2015-12-21 21:17:15 +01:00
|
|
|
LogText "Found safe port: ${I}"
|
2014-09-15 12:01:09 +02:00
|
|
|
done
|
2016-06-18 11:14:01 +02:00
|
|
|
Display --indent 6 --text "- Checking ACL 'Safe_ports' ports" --result "${STATUS_FOUND}" --color GREEN
|
2014-09-15 12:01:09 +02:00
|
|
|
AddHP 1 1
|
|
|
|
fi
|
|
|
|
#SQUID_DAEMON_UNSAFE_PORTS_LIST
|
|
|
|
for I in ${SQUID_DAEMON_UNSAFE_PORTS_LIST}; do
|
2015-12-21 21:17:15 +01:00
|
|
|
LogText "Test: Checking port ${I} in Safe_ports list"
|
2016-08-25 15:31:33 +02:00
|
|
|
FIND2=`${GREPBINARY} -w "^acl Safe_ports port ${I}" ${SQUID_DAEMON_CONFIG}`
|
2014-09-15 12:01:09 +02:00
|
|
|
if [ "${FIND2}" = "" ]; then
|
2016-06-18 11:14:01 +02:00
|
|
|
Display --indent 6 --text "- Checking ACL 'Safe_ports' (port ${I})" --result "${STATUS_NOT_FOUND}" --color GREEN
|
2014-09-15 12:01:09 +02:00
|
|
|
AddHP 1 1
|
|
|
|
else
|
2016-06-18 11:14:01 +02:00
|
|
|
Display --indent 6 --text "- Checking ACL 'Safe_ports' (port ${I})" --result "${STATUS_FOUND}" --color RED
|
2016-08-10 07:24:10 +02:00
|
|
|
ReportWarning ${TEST_NO} "Squid configuration possibly allows relaying traffic via configured Safe_port ${I}"
|
2014-09-15 12:01:09 +02:00
|
|
|
AddHP 0 1
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
fi
|
2014-08-26 17:33:55 +02:00
|
|
|
fi
|
|
|
|
#
|
|
|
|
#################################################################################
|
|
|
|
#
|
|
|
|
if [ ${SQUID_DAEMON_RUNNING} -eq 1 -a ! "${SQUID_DAEMON_CONFIG}" = "" ]; then
|
2014-09-15 12:01:09 +02:00
|
|
|
Display --indent 4 --text "- Checking Squid Denial of Service tuning options"
|
2014-08-26 17:33:55 +02:00
|
|
|
fi
|
|
|
|
#
|
|
|
|
#################################################################################
|
|
|
|
#
|
|
|
|
# Test : SQD-3630 [T]
|
|
|
|
# Description : Check reply_body_max_size value
|
|
|
|
if [ ${SQUID_DAEMON_RUNNING} -eq 1 -a ! "${SQUID_DAEMON_CONFIG}" = "" ]; then PREQS_MET="YES"; else PREQS_MET="NO"; fi
|
2016-07-24 17:22:00 +02:00
|
|
|
Register --test-no SQD-3630 --preqs-met ${PREQS_MET} --weight L --network NO --category security --description "Check Squid reply_body_max_size option"
|
2014-08-26 17:33:55 +02:00
|
|
|
if [ ${SKIPTEST} -eq 0 ]; then
|
|
|
|
N=0
|
2015-12-21 21:17:15 +01:00
|
|
|
LogText "Test: checking option reply_body_max_size"
|
2016-09-08 21:04:17 +02:00
|
|
|
FIND=`${GREPBINARY} "^reply_body_max_size " ${SQUID_DAEMON_CONFIG} | ${SEDBINARY} 's/ /!space!/g'`
|
2014-08-26 17:33:55 +02:00
|
|
|
if [ "${FIND}" = "" ]; then
|
2015-12-21 21:17:15 +01:00
|
|
|
LogText "Result: option reply_body_max_size not configured"
|
2016-06-18 11:14:01 +02:00
|
|
|
Display --indent 6 --text "- Checking option: reply_body_max_size" --result "${STATUS_NONE}" --color RED
|
2014-08-26 17:33:55 +02:00
|
|
|
AddHP 1 2
|
|
|
|
ReportSuggestion ${TEST_NO} "Configure Squid option reply_body_max_size to limit the upper size of requests."
|
|
|
|
else
|
2015-12-21 21:17:15 +01:00
|
|
|
LogText "Result: option reply_body_max_size configured"
|
|
|
|
LogText "Output: ${FIND}"
|
2016-06-18 11:14:01 +02:00
|
|
|
Display --indent 6 --text "- Checking option: reply_body_max_size" --result "${STATUS_FOUND}" --color GREEN
|
2014-08-26 17:33:55 +02:00
|
|
|
AddHP 2 2
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
#
|
|
|
|
#################################################################################
|
|
|
|
#
|
|
|
|
if [ ${SQUID_DAEMON_RUNNING} -eq 1 -a ! "${SQUID_DAEMON_CONFIG}" = "" ]; then
|
2014-09-15 12:01:09 +02:00
|
|
|
Display --indent 4 --text "- Checking Squid general options"
|
2014-08-26 17:33:55 +02:00
|
|
|
fi
|
|
|
|
#
|
|
|
|
#################################################################################
|
|
|
|
#
|
|
|
|
# Test : SQD-3680
|
|
|
|
# Description : Check httpd_suppress_version_string
|
|
|
|
if [ ${SQUID_DAEMON_RUNNING} -eq 1 -a ! "${SQUID_DAEMON_CONFIG}" = "" ]; then PREQS_MET="YES"; else PREQS_MET="NO"; fi
|
2016-07-24 17:22:00 +02:00
|
|
|
Register --test-no SQD-3680 --preqs-met ${PREQS_MET} --weight L --network NO --category security --description "Check Squid version suppresion"
|
2014-08-26 17:33:55 +02:00
|
|
|
if [ ${SKIPTEST} -eq 0 ]; then
|
2016-08-25 15:31:33 +02:00
|
|
|
FIND=`${GREPBINARY} "^httpd_suppress_version_string " ${SQUID_DAEMON_CONFIG} | ${GREPBINARY} " on"`
|
2014-08-26 17:33:55 +02:00
|
|
|
if [ "${FIND}" = "" ]; then
|
2015-12-21 21:17:15 +01:00
|
|
|
LogText "Result: option httpd_suppress_version_string not configured"
|
2016-06-18 11:14:01 +02:00
|
|
|
Display --indent 6 --text "- Checking option: httpd_supress_version_string" --result "${STATUS_NOT_FOUND}" --color YELLOW
|
2014-08-26 17:33:55 +02:00
|
|
|
AddHP 1 2
|
|
|
|
ReportSuggestion ${TEST_NO} "Configure Squid option httpd_suppress_version_string (on) to suppress the version."
|
|
|
|
else
|
2015-12-21 21:17:15 +01:00
|
|
|
LogText "Result: option httpd_suppress_version_string configured"
|
|
|
|
LogText "Output: ${FIND}"
|
2016-06-18 11:14:01 +02:00
|
|
|
Display --indent 6 --text "- Checking option: httpd_suppress_version_string" --result "${STATUS_FOUND}" --color GREEN
|
2014-08-26 17:33:55 +02:00
|
|
|
AddHP 2 2
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
#
|
|
|
|
#################################################################################
|
|
|
|
#
|
|
|
|
|
2016-04-28 12:31:57 +02:00
|
|
|
WaitForKeyPress
|
2014-08-26 17:33:55 +02:00
|
|
|
|
|
|
|
#
|
|
|
|
#================================================================================
|
2015-12-21 21:17:15 +01:00
|
|
|
# Lynis - Copyright 2007-2016 Michael Boelen, CISOfy - https://cisofy.com
|