Check for /var/db/pkg/pkgs-vulnerabilities presence before performing audit with pkg_admin [PKGS-7381]

This commit is contained in:
mboelen 2014-12-05 19:43:35 +01:00
parent 951afea1f3
commit 1fa4416a7a
1 changed files with 27 additions and 17 deletions

View File

@ -179,7 +179,6 @@
report "installed_package[]=${J}||" report "installed_package[]=${J}||"
done done
report "installed_packages=${N}" report "installed_packages=${N}"
fi fi
else else
logtext "Result: RPM binary NOT found on this system, test skipped" logtext "Result: RPM binary NOT found on this system, test skipped"
@ -399,6 +398,11 @@
fi fi
# #
################################################################################# #################################################################################
#
# Test : PKGS-7370
# Description : Check debsums output
#
#################################################################################
# #
# Test : PKGS-7378 # Test : PKGS-7378
# Description : Query FreeBSD portmaster for available port upgrades # Description : Query FreeBSD portmaster for available port upgrades
@ -429,9 +433,10 @@
Register --test-no PKGS-7381 --os NetBSD --weight L --network NO --description "Check for vulnerable NetBSD packages" Register --test-no PKGS-7381 --os NetBSD --weight L --network NO --description "Check for vulnerable NetBSD packages"
if [ ${SKIPTEST} -eq 0 ]; then if [ ${SKIPTEST} -eq 0 ]; then
if [ -x /usr/sbin/pkg_admin ]; then if [ -x /usr/sbin/pkg_admin ]; then
FIND=`/usr/sbin/pkg_admin audit`
PKG_AUDIT_TOOL_FOUND=1 PKG_AUDIT_TOOL_FOUND=1
PKG_AUDIT_TOOL="pkg_admin audit" PKG_AUDIT_TOOL="pkg_admin audit"
if [ -f /var/db/pkg/pkgs-vulnerabilities ]; then
FIND=`/usr/sbin/pkg_admin audit`
if [ "${FIND}" = "" ]; then if [ "${FIND}" = "" ]; then
logtext "Result: pkg audit results are clean" logtext "Result: pkg audit results are clean"
Display --indent 2 --text "- Checking pkg_admin audit to obtain vulnerable packages" --result NONE --color GREEN Display --indent 2 --text "- Checking pkg_admin audit to obtain vulnerable packages" --result NONE --color GREEN
@ -448,6 +453,11 @@
AddHP 1 2 AddHP 1 2
done done
fi fi
else
ReportSuggestion "${TEST_NO}" "Fetch the package database with pkg_admin fetch-pkg-vulnerabilities"
AddHP 0 2
fi
else else
Display --indent 2 --text "- pkg_admin audit not installed" --result "NOT FOUND" --color WHITE Display --indent 2 --text "- pkg_admin audit not installed" --result "NOT FOUND" --color WHITE
logtext "Result: pkg_admin audit not installed, skipping this vulnerability test." logtext "Result: pkg_admin audit not installed, skipping this vulnerability test."