mirror of https://github.com/CISOfy/lynis.git
Improved PackageIsInstalled function and its usage
This commit is contained in:
parent
256bc1da0f
commit
fd8b1e790d
|
@ -1719,7 +1719,7 @@
|
||||||
output=$(${DNFBINARY} --quiet --cacheonly --noplugins --assumeno info --installed ${package} > /dev/null 2>&1)
|
output=$(${DNFBINARY} --quiet --cacheonly --noplugins --assumeno info --installed ${package} > /dev/null 2>&1)
|
||||||
exit_code=$?
|
exit_code=$?
|
||||||
elif [ ! -z "${DPKGBINARY}" ]; then
|
elif [ ! -z "${DPKGBINARY}" ]; then
|
||||||
output=$(${DPKGBINARY} -l ${package} > /dev/null 2>&1)
|
output=$(${DPKGBINARY} -l ${package} 2> /dev/null | ${GREPBINARY} "^ii")
|
||||||
exit_code=$?
|
exit_code=$?
|
||||||
elif [ ! -z "${EQUERYBINARY}" ]; then
|
elif [ ! -z "${EQUERYBINARY}" ]; then
|
||||||
output=$(${EQUERYBINARY} --quiet ${package} > /dev/null 2>&1)
|
output=$(${EQUERYBINARY} --quiet ${package} > /dev/null 2>&1)
|
||||||
|
|
|
@ -138,8 +138,7 @@
|
||||||
if [ ${SKIPTEST} -eq 0 ]; then
|
if [ ${SKIPTEST} -eq 0 ]; then
|
||||||
# Check for installed xinetd daemon
|
# Check for installed xinetd daemon
|
||||||
LogText "Test: Checking for installed xinetd daemon"
|
LogText "Test: Checking for installed xinetd daemon"
|
||||||
PackageIsInstalled xinetd
|
if PackageIsInstalled "xinetd"; then
|
||||||
if [ $? -eq 0 ]; then
|
|
||||||
LogText "Result: xinetd is installed"
|
LogText "Result: xinetd is installed"
|
||||||
Display --indent 2 --text "- Installed xinetd package" --result "${STATUS_FOUND}" --color YELLOW
|
Display --indent 2 --text "- Installed xinetd package" --result "${STATUS_FOUND}" --color YELLOW
|
||||||
ReportSuggestion ${TEST_NO} "If there are no xinetd services required, it is recommended that the daemon be removed"
|
ReportSuggestion ${TEST_NO} "If there are no xinetd services required, it is recommended that the daemon be removed"
|
||||||
|
@ -277,7 +276,7 @@
|
||||||
FOUND=0
|
FOUND=0
|
||||||
PACKAGES="tcp_wrappers tcpd"
|
PACKAGES="tcp_wrappers tcpd"
|
||||||
for PACKAGE in ${PACKAGES}; do
|
for PACKAGE in ${PACKAGES}; do
|
||||||
if PackageIsInstalled ${PACKAGE}; then FOUND=1; fi
|
if PackageIsInstalled "${PACKAGE}"; then LogText "Package '${PACKAGE}' is installed"; FOUND=1; fi
|
||||||
done
|
done
|
||||||
if [ ${FOUND} -eq 1 ]; then
|
if [ ${FOUND} -eq 1 ]; then
|
||||||
LogText "Result: tcp_wrappers is installed"
|
LogText "Result: tcp_wrappers is installed"
|
||||||
|
@ -299,7 +298,7 @@
|
||||||
FOUND=0
|
FOUND=0
|
||||||
PACKAGES="rsh rsh-client rsh-redone-client"
|
PACKAGES="rsh rsh-client rsh-redone-client"
|
||||||
for PACKAGE in ${PACKAGES}; do
|
for PACKAGE in ${PACKAGES}; do
|
||||||
if PackageIsInstalled "${PACKAGE}"; then FOUND=1; fi
|
if PackageIsInstalled "${PACKAGE}"; then LogText "Package '${PACKAGE}' is installed"; FOUND=1; fi
|
||||||
done
|
done
|
||||||
if [ ${FOUND} -eq 1 ]; then
|
if [ ${FOUND} -eq 1 ]; then
|
||||||
LogText "Result: rsh client is installed"
|
LogText "Result: rsh client is installed"
|
||||||
|
@ -356,7 +355,7 @@
|
||||||
FOUND=0
|
FOUND=0
|
||||||
PACKAGES="rsh-server rsh-redone-server"
|
PACKAGES="rsh-server rsh-redone-server"
|
||||||
for PACKAGE in ${PACKAGES}; do
|
for PACKAGE in ${PACKAGES}; do
|
||||||
if PackageIsInstalled "${PACKAGE}"; then FOUND=1; fi
|
if PackageIsInstalled "${PACKAGE}"; then LogText "Package '${PACKAGE}' is installed"; FOUND=1; fi
|
||||||
done
|
done
|
||||||
if [ ${FOUND} -eq 1 ]; then
|
if [ ${FOUND} -eq 1 ]; then
|
||||||
LogText "Result: rsh server is installed"
|
LogText "Result: rsh server is installed"
|
||||||
|
@ -377,7 +376,8 @@
|
||||||
if [ ${SKIPTEST} -eq 0 ]; then
|
if [ ${SKIPTEST} -eq 0 ]; then
|
||||||
# Check if telnet client is installed
|
# Check if telnet client is installed
|
||||||
LogText "Test: Checking if telnet client is installed"
|
LogText "Test: Checking if telnet client is installed"
|
||||||
if PackageIsInstalled "${PACKAGE}"; then FOUND=1; fi
|
if PackageIsInstalled "${PACKAGE}"; then LogText "Package '${PACKAGE}' is installed"; FOUND=1; fi
|
||||||
|
|
||||||
if [ ${FOUND} -eq 1 ]; then
|
if [ ${FOUND} -eq 1 ]; then
|
||||||
LogText "Result: telnet client is installed"
|
LogText "Result: telnet client is installed"
|
||||||
Display --indent 2 --text "- Installed telnet client package" --result "${STATUS_FOUND}" --color YELLOW
|
Display --indent 2 --text "- Installed telnet client package" --result "${STATUS_FOUND}" --color YELLOW
|
||||||
|
@ -400,7 +400,7 @@
|
||||||
FOUND=0
|
FOUND=0
|
||||||
PACKAGES="telnetd telnet-server"
|
PACKAGES="telnetd telnet-server"
|
||||||
for PACKAGE in ${PACKAGES}; do
|
for PACKAGE in ${PACKAGES}; do
|
||||||
if PackageIsInstalled "${PACKAGE}"; then FOUND=1; fi
|
if PackageIsInstalled "${PACKAGE}"; then LogText "Package '${PACKAGE}' is installed"; FOUND=1; fi
|
||||||
done
|
done
|
||||||
if [ ${FOUND} -eq 1 ]; then
|
if [ ${FOUND} -eq 1 ]; then
|
||||||
LogText "Result: telnet server is installed"
|
LogText "Result: telnet server is installed"
|
||||||
|
|
Loading…
Reference in New Issue