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:
authormboelen <michael@cisofy.com>2014-09-19 01:56:16 +0400
committermboelen <michael@cisofy.com>2014-09-19 01:56:16 +0400
commit1ed24265e339f1731944f48a671951ec901cbc63 (patch)
tree3447591ff828790b2f8a8c871e47fafae402a020
parent82304397cbca9177556de6c07cc0db210e4e7434 (diff)
Adjusted normal user ID detection and added exception for currently unsupported operating systems
-rw-r--r--include/tests_authentication37
1 files changed, 22 insertions, 15 deletions
diff --git a/include/tests_authentication b/include/tests_authentication
index abfd1c9d..de88de5f 100644
--- a/include/tests_authentication
+++ b/include/tests_authentication
@@ -334,36 +334,43 @@
#################################################################################
#
# Test : AUTH-9234
- # Description : Query user accounts (YYY)
+ # Description : Query user accounts
# Notes : HPUX > 100
# MacOS: need to be improved (just reading passwd file is not enough)
# OpenBSD/NetBSD: unknown
Register --test-no AUTH-9234 --os Linux --weight L --network NO --description "Query user accounts"
if [ ${SKIPTEST} -eq 0 ]; then
- logtext "Test: Read real system users (including root user) from /etc/passwd"
+ logtext "Test: Read system users (including root user) from /etc/passwd"
FIND=""
- if [ "${OS}" = "FreeBSD" ]; then
- logtext "FreeBSD real users output (ID > 1000, but not 65534):"
- FIND=`awk -F: '($3 > 1000) && ($3 != 65534) || ($3 == 0) { print $1","$3 }' /etc/passwd`
- fi
+ case ${OS} in
+ "FreeBSD")
+ logtext "FreeBSD real users output (ID = 0, or 1000+, but not 65534):"
+ FIND=`awk -F: '($3 >= 1000) && ($3 != 65534) || ($3 == 0) { print $1","$3 }' /etc/passwd`
+ ;;
- if [ "${OS}" = "Linux" ]; then
- logtext "Linux real users output (ID > 500, but not 65534):"
- FIND=`awk -F: '($3 > 500) && ($3 != 65534) || ($3 == 0) { print $1","$3 }' /etc/passwd`
- fi
+ "Linux")
+ logtext "Linux real users output (ID = 0, or 500+, but not 65534):"
+ FIND=`awk -F: '($3 >= 500) && ($3 != 65534) || ($3 == 0) { print $1","$3 }' /etc/passwd`
+ ;;
- if [ "${OS}" = "Solaris" ]; then
- logtext "Solaris real users output (ID > 100, but not 60001/65534):"
- FIND=`awk -F: '($3 > 100 && $3 != 60001 && $3 != 65534) || ($3 == 0) { print $1","$3 }' /etc/passwd`
- fi
+ "Solaris")
+ logtext "Solaris real users output (ID =0, or 100+, but not 60001/65534):"
+ FIND=`awk -F: '($3 >= 100 && $3 != 60001 && $3 != 65534) || ($3 == 0) { print $1","$3 }' /etc/passwd`
+ ;;
+ *)
+ # Want to help improving Lynis? Determine what user IDs belong to normal user accounts
+ ReportException "${TEST_NO}:1" "Can not determine user accounts"
+ ;;
+ esac
- Display --indent 2 --text "- Query system users (non daemons)" --result DONE --color GREEN
# Check if we got any output
if [ "${FIND}" = "" ]; then
Display --indent 4 --text "Result: No users found/unknown result"
logtext "Result: Querying of system users skipped"
+ Display --indent 2 --text "- Query system users (non daemons)" --result UNKNOWN --color YELLOW
else
+ Display --indent 2 --text "- Query system users (non daemons)" --result DONE --color GREEN
for I in ${FIND}; do
logtext "Real user: ${I}"
report "real_user[]=${I}"