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>2016-07-31 14:45:21 +0300
committerMichael Boelen <michael.boelen@cisofy.com>2016-07-31 14:45:21 +0300
commit6426ce68c000c05e31ecaee8a59ab285ab72d456 (patch)
tree39773b1bdf7bdf54bdad447cefa6d824debe6b08
parentd951be44098d8ba2b3d06351b38c0fcd129c1b94 (diff)
[AUTH-9216] Simplified test and make it more efficient
-rw-r--r--include/tests_authentication36
1 files changed, 17 insertions, 19 deletions
diff --git a/include/tests_authentication b/include/tests_authentication
index 4bad7e5e..12f9257d 100644
--- a/include/tests_authentication
+++ b/include/tests_authentication
@@ -116,36 +116,34 @@
#
# Test : AUTH-9216
# Description : Check /etc/group and shadow group files
+ # Notes : Run grpck to test group files (most likely /etc/group and shadow group files)
if [ ! "${GRPCKBINARY}" = "" ]; then PREQS_MET="YES"; else PREQS_MET="NO"; fi
Register --test-no AUTH-9216 --preqs-met ${PREQS_MET} --weight L --network NO --root-only YES --category security --description "Check group and shadow group files"
if [ ${SKIPTEST} -eq 0 ]; then
- # Test : run grpck to test group files (most likely /etc/group and shadow group files)
- # Expected result : 0 (exit code)
- LogText "Test: Checking for grpck binary"
+ LogText "Test: Checking for grpck binary output"
- if [ "${OS}" = "Linux" ]; then
- # Read only mode
- FIND=`${GRPCKBINARY} -r 2> /dev/null ; echo $?`
- elif [ "${OS}" = "AIX" ]; then
- FIND=`${GRPCKBINARY} -n ALL 2> /dev/null ; echo $?`
- else
- FIND=`${GRPCKBINARY} 2> /dev/null ; echo $?`
- fi
-
- # Overrule for SuSE
- if [ "${LINUX_VERSION}" = "SuSE" ]; then
- FIND=`${GRPCKBINARY} -q -r > /dev/null ; echo $?`
- fi
+ case ${OS} in
+ "AIX") FIND=$(${GRPCKBINARY} -n ALL 2> /dev/null ; echo $?) ;;
+ "Linux")
+ if [ "${LINUX_VERSION}" = "SuSE" ]; then
+ FIND=$(${GRPCKBINARY} -q -r > /dev/null ; echo $?)
+ else
+ FIND=$(${GRPCKBINARY} -r 2> /dev/null ; echo $?)
+ fi
+ ;;
+ *) FIND=$(${GRPCKBINARY} 2> /dev/null ; echo $?) ;;
+ esac
# Check exit-code
if [ "${FIND}" = "0" ]; then
- Display --indent 2 --text "- Checking consistency of group files (grpck)" --result "${STATUS_OK}" --color GREEN
+ Display --indent 2 --text "- Consistency of group files (grpck)" --result "${STATUS_OK}" --color GREEN
LogText "Result: grpck binary didn't find any errors in the group files"
- else
- Display --indent 2 --text "- Checking consistency of group files (grpck)" --result "${STATUS_WARNING}" --color RED
+ else
+ Display --indent 2 --text "- Consistency of group files (grpck)" --result "${STATUS_WARNING}" --color RED
ReportWarning ${TEST_NO} "M" "grpck binary found errors in one or more group files"
ReportSuggestion ${TEST_NO} "Run grpck manually and check your group files"
fi
+ unset FIND
fi
#
#################################################################################