59 lines
1.8 KiB
Bash
59 lines
1.8 KiB
Bash
#!/bin/sh
|
|
|
|
#################################################################################
|
|
#
|
|
# Author: Thomas Biege <thomas@suse.de>
|
|
#
|
|
# Lynis comes with ABSOLUTELY NO WARRANTY. This is free software, and you are
|
|
# welcome to redistribute it under the terms of the GNU General Public License.
|
|
# See LICENSE file for usage of this software.
|
|
#
|
|
#################################################################################
|
|
#
|
|
# Verifies dbus policy.
|
|
#
|
|
#################################################################################
|
|
#
|
|
# TODO:
|
|
#
|
|
################################################################################
|
|
#
|
|
InsertSection "Users, Groups and Authentication"
|
|
report "[Software]"
|
|
#
|
|
#################################################################################
|
|
#
|
|
# Test : AUTH-1000
|
|
# Description : Verifies dbus policy.
|
|
Register --test-no AUTH-1000 --weight M --network NO --description "Verifies if users without a password exist."
|
|
if [ ${SKIPTEST} -eq 0 ]; then
|
|
Display --indent 2 --text "- Starting password check for users..."
|
|
logtext "Test: Checking existence of password"
|
|
|
|
TMPDIR=$(mktemp -d /tmp/lynis.XXXXXX)
|
|
HPMAX=$(wc -l /etc/passwd | cut -d' ' -f1)
|
|
awk -F: '$2 == "" && $1 != "" {print $1}' /etc/passwd > $TMPDIR/userwopwd
|
|
awk -F: '$2 == "" && $1 != "" {print $1}' /etc/shadow >> $TMPDIR/userwopwd
|
|
sort -u $TMPDIR/userwopwd > $TMPDIR/userwopwd2
|
|
HPBAD=0
|
|
for i in $(cat $TMPDIR/userwopwd2)
|
|
do
|
|
HPBAD=$((HPBAD + 1))
|
|
Display --indent 4 --text "${i} has no password set" --result WARNING --color RED
|
|
done
|
|
|
|
HP=$(expr $HPMAX - $HPBAD)
|
|
# echo "AddHP $HP $HPMAX"
|
|
AddHP $HP $HPMAX
|
|
|
|
rm -rf $TMPDIR
|
|
fi
|
|
#
|
|
#################################################################################
|
|
#
|
|
|
|
wait_for_keypress
|
|
|
|
#
|
|
#================================================================================
|