mirror of https://github.com/CISOfy/lynis.git
Make sure that the input of "uniq -d" is sorted to avoid that duplicate UID's and hosts entries are missed.
This commit is contained in:
parent
bf1da50c14
commit
b7d24c3413
|
@ -69,7 +69,7 @@
|
||||||
fi
|
fi
|
||||||
# Check password file
|
# Check password file
|
||||||
if [ -f ${PASSWD_FILE} ]; then
|
if [ -f ${PASSWD_FILE} ]; then
|
||||||
FIND=`cat ${PASSWD_FILE} | grep -v '^#' | cut -d ':' -f3 | uniq -d`
|
FIND=`cat ${PASSWD_FILE} | grep -v '^#' | cut -d ':' -f3 | sort | uniq -d`
|
||||||
if [ "${FIND}" = "" ]; then
|
if [ "${FIND}" = "" ]; then
|
||||||
Display --indent 2 --text "- Checking for non-unique UIDs" --result OK --color GREEN
|
Display --indent 2 --text "- Checking for non-unique UIDs" --result OK --color GREEN
|
||||||
logtext "Result: all accounts found in ${PASSWD_FILE} are unique"
|
logtext "Result: all accounts found in ${PASSWD_FILE} are unique"
|
||||||
|
|
|
@ -588,7 +588,7 @@
|
||||||
if [ ${SKIPTEST} -eq 0 ]; then
|
if [ ${SKIPTEST} -eq 0 ]; then
|
||||||
logtext "Test: check duplicate line in /etc/hosts"
|
logtext "Test: check duplicate line in /etc/hosts"
|
||||||
if [ -f /etc/hosts ]; then
|
if [ -f /etc/hosts ]; then
|
||||||
sFIND=`cat /etc/hosts | egrep -v '^(#|$)' | uniq -d`
|
sFIND=`cat /etc/hosts | egrep -v '^(#|$)' | sort | uniq -d`
|
||||||
if [ "${sFIND}" = "" ]; then
|
if [ "${sFIND}" = "" ]; then
|
||||||
logtext "Result: OK, no duplicate lines found"
|
logtext "Result: OK, no duplicate lines found"
|
||||||
Display --indent 4 --text "- Checking /etc/hosts (duplicates)" --result OK --color GREEN
|
Display --indent 4 --text "- Checking /etc/hosts (duplicates)" --result OK --color GREEN
|
||||||
|
|
Loading…
Reference in New Issue