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:
authorThomas Sjögren <konstruktoid@users.noreply.github.com>2020-12-14 23:43:14 +0300
committerThomas Sjögren <konstruktoid@users.noreply.github.com>2020-12-14 23:43:14 +0300
commit76e89b525b7cee1f6d44b24ea1487ce727d1e6f2 (patch)
tree7a1c37fa616441638eaf77c80aeb830ac6d12340
parent22a9fe703755bd83a9b4363b1ccc06c93e06148c (diff)
only fail AUTH-9230 if no _MAX_ROUNDS is defined
Signed-off-by: Thomas Sjögren <konstruktoid@users.noreply.github.com>
-rw-r--r--include/tests_authentication68
1 files changed, 35 insertions, 33 deletions
diff --git a/include/tests_authentication b/include/tests_authentication
index b27e59c7..2a166848 100644
--- a/include/tests_authentication
+++ b/include/tests_authentication
@@ -360,42 +360,44 @@
fi
Register --test-no AUTH-9230 --preqs-met ${PREQS_MET} --root-only NO --weight L --network NO --category security --description "Check group password hashing rounds"
if [ ${SKIPTEST} -eq 0 ]; then
- LogText "Test: Checking SHA_CRYPT_MIN_ROUNDS option in ${ROOTDIR}etc/login.defs"
- FIND=$(${GREPBINARY} "^SHA_CRYPT_MIN_ROUNDS" ${ROOTDIR}etc/login.defs | ${AWKBINARY} '{ if ($1=="SHA_CRYPT_MIN_ROUNDS") { print $2 } }')
- if [ -z "${FIND}" -o "${FIND}" = "0" ]; then
- LogText "Result: number of minimum rounds used by the encryption algorithm is not configured"
- Display --indent 2 --text "- Checking minimum group password hashing rounds" --result "${STATUS_DISABLED}" --color YELLOW
- ReportSuggestion "${TEST_NO}" "Configure minimum encryption algorithm rounds in /etc/login.defs"
+ SHA_CRYPT_MIN_ROUNDS_FIND=$(${GREPBINARY} "^SHA_CRYPT_MIN_ROUNDS" ${ROOTDIR}etc/login.defs | ${AWKBINARY} '{ if ($1=="SHA_CRYPT_MIN_ROUNDS") { print $2 } }')
+ SHA_CRYPT_MAX_ROUNDS_FIND=$(${GREPBINARY} "^SHA_CRYPT_MAX_ROUNDS" ${ROOTDIR}etc/login.defs | ${AWKBINARY} '{ if ($1=="SHA_CRYPT_MAX_ROUNDS") { print $2 } }')
+
+ if [ -z "${SHA_CRYPT_MIN_ROUNDS_FIND}" -o "${SHA_CRYPT_MIN_ROUNDS_FIND}" = "0" ] && [ -z "${SHA_CRYPT_MAX_ROUNDS_FIND}" -o "${SHA_CRYPT_MAX_ROUNDS_FIND}" = "0" ]; then
+ LogText "Result: number of rounds used by the encryption algorithm is not configured"
+ Display --indent 2 --text "- Checking group password hashing rounds" --result "${STATUS_DISABLED}" --color YELLOW
+ ReportSuggestion "${TEST_NO}" "Configure encryption algorithm rounds in /etc/login.defs"
AddHP 0 2
- elif [ "${FIND}" -lt 5000 ]; then
- LogText "Result: low number of minimum encryption algorithm rounds found: ${FIND}"
- PASSWORD_MINIMUM_ROUNDS=${FIND}
- Display --indent 2 --text "- Group password hashing rounds (minimum)" --result "${STATUS_SUGGESTION}" --color YELLOW
- AddHP 1 2
- else
- LogText "Result: number of encryption algorithm rounds is ${FIND}"
- PASSWORD_MINIMUM_ROUNDS=${FIND}
- Display --indent 2 --text "- Group password hashing rounds (minimum)" --result CONFIGURED --color GREEN
- AddHP 2 2
fi
- LogText "Test: Checking SHA_CRYPT_MAX_ROUNDS option in ${ROOTDIR}etc/login.defs"
- FIND=$(${GREPBINARY} "^SHA_CRYPT_MAX_ROUNDS" ${ROOTDIR}etc/login.defs | ${AWKBINARY} '{ if ($1=="SHA_CRYPT_MAX_ROUNDS") { print $2 } }')
- if [ -z "${FIND}" -o "${FIND}" = "0" ]; then
- LogText "Result: number of maximum rounds used by the encryption algorithm is not configured"
- Display --indent 2 --text "- Checking maximum group password hashing rounds" --result "${STATUS_DISABLED}" --color YELLOW
- ReportSuggestion "${TEST_NO}" "Configure maximum encryption algorithm rounds in /etc/login.defs"
- AddHP 0 2
- elif [ "${FIND}" -lt 10000 ]; then
- LogText "Result: low number of maximum encryption algorithm rounds found: ${FIND}"
- PASSWORD_MINIMUM_ROUNDS=${FIND}
- Display --indent 2 --text "- Group password hashing rounds (maximum)" --result "${STATUS_SUGGESTION}" --color YELLOW
- AddHP 1 2
- else
- LogText "Result: number of encryption algorithm rounds is ${FIND}"
- PASSWORD_MINIMUM_ROUNDS=${FIND}
- Display --indent 2 --text "- Group password hashing rounds (maximum)" --result CONFIGURED --color GREEN
- AddHP 2 2
+ if [ -n "${SHA_CRYPT_MIN_ROUNDS_FIND}" ]; then
+ LogText "Test: Checking SHA_CRYPT_MIN_ROUNDS option in ${ROOTDIR}etc/login.defs"
+ if [ "${SHA_CRYPT_MIN_ROUNDS_FIND}" -lt 5000 ]; then
+ LogText "Result: low number of minimum encryption algorithm rounds found: ${SHA_CRYPT_MIN_ROUNDS_FIND}"
+ PASSWORD_MINIMUM_ROUNDS=${SHA_CRYPT_MIN_ROUNDS_FIND}
+ Display --indent 2 --text "- Group password hashing rounds (minimum)" --result "${STATUS_SUGGESTION}" --color YELLOW
+ AddHP 1 2
+ else
+ LogText "Result: number of encryption algorithm rounds is ${SHA_CRYPT_MIN_ROUNDS_FIND}"
+ PASSWORD_MINIMUM_ROUNDS=${SHA_CRYPT_MIN_ROUNDS_FIND}
+ Display --indent 2 --text "- Group password hashing rounds (minimum)" --result CONFIGURED --color GREEN
+ AddHP 2 2
+ fi
+ fi
+
+ if [ -n "${SHA_CRYPT_MAX_ROUNDS_FIND}" ]; then
+ LogText "Test: Checking SHA_CRYPT_MAX_ROUNDS option in ${ROOTDIR}etc/login.defs"
+ if [ "${SHA_CRYPT_MAX_ROUNDS_FIND}" -lt 10000 ]; then
+ LogText "Result: low number of maximum encryption algorithm rounds found: ${SHA_CRYPT_MAX_ROUNDS_FIND}"
+ PASSWORD_MAXIMUM_ROUNDS=${SHA_CRYPT_MAX_ROUNDS_FIND}
+ Display --indent 2 --text "- Group password hashing rounds (maximum)" --result "${STATUS_SUGGESTION}" --color YELLOW
+ AddHP 1 2
+ else
+ LogText "Result: number of encryption algorithm rounds is ${SHA_CRYPT_MAX_ROUNDS_FIND}"
+ PASSWORD_MAXIMUM_ROUNDS=${SHA_CRYPT_MAX_ROUNDS_FIND}
+ Display --indent 2 --text "- Group password hashing rounds (maximum)" --result CONFIGURED --color GREEN
+ AddHP 2 2
+ fi
fi
fi
#