From 4dc0b50408d56662fe620f461915ad9eeb07acbe Mon Sep 17 00:00:00 2001 From: jonnyCodev Date: Wed, 5 Feb 2020 11:22:34 +0200 Subject: [PATCH] Check if root user have unused console login --- checks/check11 | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/checks/check11 b/checks/check11 index a72c704c13..aa47cadbff 100644 --- a/checks/check11 +++ b/checks/check11 @@ -14,8 +14,15 @@ CHECK_SCORED_check11="SCORED" CHECK_TYPE_check11="LEVEL1" CHECK_ALTERNATE_check101="check11" +MAX_DAYS=-1 check11(){ # "Avoid the use of the root account (Scored)." - COMMAND11=$(cat $TEMP_REPORT_FILE| grep '' | cut -d, -f5,11,16 | sed 's/,/\ /g') - textInfo "Root account last accessed (password key_1 key_2): $COMMAND11" + MAX_DAYS=-1 + last_login_date=$(cat $TEMP_REPORT_FILE|awk -F, '{ print $1,$5 }' |grep '' | awk '{ print $2 }') + days_not_in_use=$(how_many_days_from_today ${last_login_date%T*}) + if [ "$days_not_in_use" -lt "$MAX_DAYS" ];then + textFail "User root_account has not used console login for more then ${MAX_DAYS#-} days" + else + textPass "User root_account has used console login in the past ${MAX_DAYS#-} days" + fi }