improved error handling on check111

This commit is contained in:
Toni de la Fuente
2018-04-11 14:09:55 -04:00
parent 8f86a5319f
commit 98a1f4bda0

View File

@@ -11,16 +11,18 @@
CHECK_ID_check111="1.11"
CHECK_TITLE_check111="[check111] Ensure IAM password policy expires passwords within 90 days or less (Scored)"
CHECK_SCORED_check111="SCORED"
CHECK_ALTERNATE_check111="check111"
CHECK_ALTERNATE_check111="check111"
check111(){
# "Ensure IAM password policy expires passwords within 90 days or less (Scored)"
COMMAND111=$($AWSCLI iam get-account-password-policy $PROFILE_OPT --region $REGION --output json | grep MaxPasswordAge | awk -F: '{ print $2 }'|sed 's/\ //g'|sed 's/,/ /g' 2> /dev/null)
COMMAND111=$($AWSCLI iam get-account-password-policy $PROFILE_OPT --region $REGION --query PasswordPolicy.MaxPasswordAge --output text 2> /dev/null)
if [[ $COMMAND111 ]];then
if [ "$COMMAND111" == "90" ];then
textPass "Password Policy includes expiration"
else
textFail "Password expiration is set greater than 90 days"
fi
else
textFail "Password expiration not set or set greater than 90 days "
textFail "Password expiration is not set"
fi
}