From 8798861c99d00593e160d031db5b3b83eed10d7d Mon Sep 17 00:00:00 2001 From: "jlamande@gmail.com" Date: Wed, 17 Oct 2018 10:16:49 +0200 Subject: [PATCH] fix(check13): should not pass if user never logged in --- checks/check13 | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/checks/check13 b/checks/check13 index b6d4392f..aeab1944 100644 --- a/checks/check13 +++ b/checks/check13 @@ -21,11 +21,16 @@ check13(){ if [[ $COMMAND12_LIST_USERS_WITH_PASSWORD_ENABLED ]]; then for i in $COMMAND12_LIST_USERS_WITH_PASSWORD_ENABLED; do DATEUSED=$($AWSCLI iam list-users --query "Users[?UserName=='$i'].PasswordLastUsed" --output text $PROFILE_OPT --region $REGION | cut -d'T' -f1) - HOWOLDER=$(how_older_from_today $DATEUSED) - if [ $HOWOLDER -gt "90" ];then + if [ "$DATEUSED" == "" ] + then textFail "User \"$i\" has not logged in during the last 90 days " else - textPass "User \"$i\" found with credentials used in the last 90 days" + HOWOLDER=$(how_older_from_today $DATEUSED) + if [ $HOWOLDER -gt "90" ];then + textFail "User \"$i\" has not logged in during the last 90 days " + else + textPass "User \"$i\" found with credentials used in the last 90 days" + fi fi done else