[PKGS-7388] Readability improvements and initialization

This commit is contained in:
Michael Boelen 2016-07-30 16:40:44 +02:00
parent 0d45379132
commit cfdc8228fd
3 changed files with 26 additions and 13 deletions

View File

@ -78,8 +78,11 @@ unset LANG
CUSTOM_URL_PROTOCOL=""
DATABASE_ENGINE_RUNNING=0
DB2_RUNNING=0
DEBSECANBINARY=""
DEBSUMSBINARY=""
DEVELOPER_MODE=0
DISCOVERED_BINARIES=""
DNFBINARY=""
DOCKER_DAEMON_RUNNING=0
ECHOCMD=""
ERROR_ON_WARNINGS=0
@ -103,6 +106,7 @@ unset LANG
LMDBINARY=""
LMDFOUND=0
LOGFILE=""
LSVGBINARY=""
MACHINEID=""
MACHINE_ROLE=""
MALWARE_SCANNER_INSTALLED=0
@ -132,10 +136,12 @@ unset LANG
NGINX_ROOT_FOUND=0
NGINX_WEAK_SSL_PROTOCOL_FOUND=0
NTPD_ROLE=""
OPTION_DEBIAN_SKIP_SECURITY_REPOSITORY=0
ORACLE_RUNNING=0
OS=""; OS_MODE=""
OS_REDHAT_OR_CLONE=0
OSIRISBINARY=""
PACMANBINARY=""
PASSWORD_MAXIMUM_DAYS=-1
PASSWORD_MINIMUM_DAYS=-1
PAM_2F_AUTH_ENABLED=0
@ -157,7 +163,9 @@ unset LANG
PSBINARY="ps"
REDIS_RUNNING=0
REMOTE_LOGGING_ENABLED=0
RESOLV_DOMAINNAME=""
RKHUNTERBINARY=""
RPCINFOBINARY=""
RPMBINARY=""
RUN_HELPERS=0
RUN_TESTS=1
@ -170,6 +178,7 @@ unset LANG
SETTINGS_FILE=""
SET_STRICT=0
SHELL_IS_BUSYBOX=0
SHOWMOUNTBINARY=""
SHOW_PROGRAM_DETAILS=1
SHOW_REPORT=1
SHOW_TOOL_TIPS=1 # Show inline tool tips (default true)
@ -209,6 +218,8 @@ unset LANG
VERBOSE=0
VMTYPE=""
VULNERABLE_PACKAGES_FOUND=0
YUMBINARY=""
ZYPPERBINARY=""
#
#################################################################################
#

View File

@ -102,7 +102,8 @@
# Do not check security repository in sources.list (Debian/Ubuntu)
debian_skip_security_repository)
OPTION_DEBIAN_SKIP_SECURITY_REPOSITORY="${VALUE}"
FIND=$(echo "${VALUE}" | egrep "^(1|true|yes)") && OPTION_DEBIAN_SKIP_SECURITY_REPOSITORY=1
AddSetting "debian-skip-security-repository" "OPTION_DEBIAN_SKIP_SECURITY_REPOSITORY" "Skip checking for a security repository (Debian and others)"
;;
debug)
FIND=`echo "${VALUE}" | egrep "^(1|true|yes)"` && DEBUG=1

View File

@ -843,44 +843,45 @@
Register --test-no PKGS-7388 --preqs-met ${PREQS_MET} --weight L --network NO --category security --description "Check security repository in Debian/ubuntu apt sources.list file"
if [ $SKIPTEST -eq 0 ]; then
FOUND=0
if [ ! "${OPTION_DEBIAN_SKIP_SECURITY_REPOSITORY}" = "yes" ]; then
if [ ${OPTION_DEBIAN_SKIP_SECURITY_REPOSITORY} -eq 0 ]; then
if [ -f /etc/apt/sources.list ]; then
LogText "Searching for security.debian.org/security.ubuntu.com or security repositories in /etc/apt/sources.list file"
FIND=`egrep "security.debian.org|security.ubuntu.com|-security " /etc/apt/sources.list | grep -v '#' | sed 's/ /!space!/g'`
FIND=$(egrep "security.debian.org|security.ubuntu.com|-security " /etc/apt/sources.list | grep -v '#' | sed 's/ /!space!/g')
if [ ! "${FIND}" = "" ]; then
FOUND=1
Display --indent 2 --text "- Checking security repository in sources.list file" --result "${STATUS_OK}" --color GREEN
LogText "Result: Found security repository in /etc/apt/sources.list"
for I in ${FIND}; do
I=`echo ${I} | sed 's/!space!/ /g'`
LogText "Output: ${I}"
for REPO in ${FIND}; do
REPO=$(echo ${REPO} | sed 's/!space!/ /g')
LogText "Output: ${REPO}"
done
fi
fi
if [ -d /etc/apt/sources.list.d ]; then
LogText "Searching for security.debian.org/security.ubuntu.com or security repositories in /etc/apt/sources.list.d directory"
FIND=`egrep -r "security.debian.org|security.ubuntu.com|-security " /etc/apt/sources.list.d | grep -v '#' | sed 's/ /!space!/g'`
if [ ! "${FIND}" = "" ]; then
FIND=$(egrep -r "security.debian.org|security.ubuntu.com|-security " /etc/apt/sources.list.d | grep -v '#' | sed 's/ /!space!/g')
if [ ! -z "${FIND}" ]; then
FOUND=1
Display --indent 2 --text "- Checking security repository in sources.list.d directory" --result "${STATUS_OK}" --color GREEN
LogText "Result: Found security repository in one or more files in directory /etc/apt/sources.list.d"
for I in ${FIND}; do
I=`echo ${I} | sed 's/!space!/ /g'`
LogText "Output: ${I}"
for REPO in ${FIND}; do
REPO=$(echo ${REPO} | sed 's/!space!/ /g')
LogText "Output: ${REPO}"
done
fi
fi
if [ ${FOUND} -eq 1 ]; then
LogText "Result: security repository was found"
AddHP 3 3
else
else
Display --indent 2 --text "- Checking security repository in sources.list file or directory" --result "${STATUS_WARNING}" --color RED
ReportWarning ${TEST_NO} "M" "Can't find any security repository in /etc/apt/sources.list or sources.list.d directory"
AddHP 0 3
fi
else
else
LogText "Skipped as option is set to ignore security repository"
fi
unset FIND FOUND REPO
fi
#
#################################################################################