From 8452a1b8c0c454f75cae0971602582799d81a2d5 Mon Sep 17 00:00:00 2001 From: Clemens Schwaighofer Date: Thu, 21 Dec 2023 13:35:50 +0900 Subject: [PATCH] Fix pre check for ssh login checks --- bin/check_last_login.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/check_last_login.sh b/bin/check_last_login.sh index f380417..8e376df 100755 --- a/bin/check_last_login.sh +++ b/bin/check_last_login.sh @@ -155,7 +155,7 @@ for ssh_group in ${ssh_groups[@]}; do found=$(grep "${username};" "${AUTH_LOG}"); fi; # always pre work account dates if they exist, but output only if text - if [ ! -z "${user_create_date_string}" ]; then + if [ -z "${found}" ] && [ ! -z "${user_create_date_string}" ]; then user_create_date=$(echo "${user_create_date_string}" | date +"%s" -f -); # if all empty, we continue with only check if user has last login date # else get days since creation