Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/CISOfy/lynis.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Boelen <michael.boelen@cisofy.com>2019-04-08 16:09:18 +0300
committerMichael Boelen <michael.boelen@cisofy.com>2019-04-08 16:09:18 +0300
commitfd8b1e790d3eb7e3d98b89fc66edd392862f8430 (patch)
tree05888554f2438476abbd916d37da481058d6dece
parent256bc1da0fec522dc6cce84bba499416c367f6d8 (diff)
Improved PackageIsInstalled function and its usage
-rw-r--r--include/functions2
-rw-r--r--include/tests_insecure_services14
2 files changed, 8 insertions, 8 deletions
diff --git a/include/functions b/include/functions
index 26d8c378..b15bda88 100644
--- a/include/functions
+++ b/include/functions
@@ -1719,7 +1719,7 @@
output=$(${DNFBINARY} --quiet --cacheonly --noplugins --assumeno info --installed ${package} > /dev/null 2>&1)
exit_code=$?
elif [ ! -z "${DPKGBINARY}" ]; then
- output=$(${DPKGBINARY} -l ${package} > /dev/null 2>&1)
+ output=$(${DPKGBINARY} -l ${package} 2> /dev/null | ${GREPBINARY} "^ii")
exit_code=$?
elif [ ! -z "${EQUERYBINARY}" ]; then
output=$(${EQUERYBINARY} --quiet ${package} > /dev/null 2>&1)
diff --git a/include/tests_insecure_services b/include/tests_insecure_services
index 2b673072..841189d8 100644
--- a/include/tests_insecure_services
+++ b/include/tests_insecure_services
@@ -138,8 +138,7 @@
if [ ${SKIPTEST} -eq 0 ]; then
# Check for installed xinetd daemon
LogText "Test: Checking for installed xinetd daemon"
- PackageIsInstalled xinetd
- if [ $? -eq 0 ]; then
+ if PackageIsInstalled "xinetd"; then
LogText "Result: xinetd is installed"
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"
@@ -277,7 +276,7 @@
FOUND=0
PACKAGES="tcp_wrappers tcpd"
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
if [ ${FOUND} -eq 1 ]; then
LogText "Result: tcp_wrappers is installed"
@@ -299,7 +298,7 @@
FOUND=0
PACKAGES="rsh rsh-client rsh-redone-client"
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
if [ ${FOUND} -eq 1 ]; then
LogText "Result: rsh client is installed"
@@ -356,7 +355,7 @@
FOUND=0
PACKAGES="rsh-server rsh-redone-server"
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
if [ ${FOUND} -eq 1 ]; then
LogText "Result: rsh server is installed"
@@ -377,7 +376,8 @@
if [ ${SKIPTEST} -eq 0 ]; then
# Check 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
LogText "Result: telnet client is installed"
Display --indent 2 --text "- Installed telnet client package" --result "${STATUS_FOUND}" --color YELLOW
@@ -400,7 +400,7 @@
FOUND=0
PACKAGES="telnetd telnet-server"
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
if [ ${FOUND} -eq 1 ]; then
LogText "Result: telnet server is installed"