mirror of
https://github.com/ghndrx/prowler.git
synced 2026-02-11 07:15:15 +00:00
32 lines
1.6 KiB
Plaintext
32 lines
1.6 KiB
Plaintext
CHECK_ID_check123=""
|
|
CHECK_TITLE_check123=""
|
|
CHECK_SCORED_check123=""
|
|
CHECK_TYPE_check123=""
|
|
CHECK_ALTERNATE_check123="check123"
|
|
|
|
check123(){
|
|
# "Do not setup access keys during initial user setup for all IAM users that have a console password (Not Scored)"
|
|
textTitle "$ID123" "$TITLE123" "NOT_SCORED" "LEVEL1"
|
|
LIST_USERS=$($AWSCLI iam list-users --query 'Users[*].UserName' --output text $PROFILE_OPT --region $REGION)
|
|
# List of USERS with KEY1 last_used_date as N/A
|
|
LIST_USERS_KEY1_NA=$(for user in $LIST_USERS; do grep "^${user}," $TEMP_REPORT_FILE|awk -F, '{ print $1,$11 }'|grep N/A |awk '{ print $1 }'; done)
|
|
LIST_USERS_KEY1_ACTIVE=$(for user in $LIST_USERS_KEY1_NA; do grep "^${user}," $TEMP_REPORT_FILE|awk -F, '{ print $1,$9 }'|grep "true$"|awk '{ print $1 }'|sed 's/[[:blank:]]+/,/g' ; done)
|
|
if [[ $LIST_USERS_KEY1_ACTIVE ]]; then
|
|
for user in $LIST_USERS_KEY1_ACTIVE; do
|
|
textNotice "$user has never used Access Key 1"
|
|
done
|
|
else
|
|
textOK "No users found with Access Key 1 never used"
|
|
fi
|
|
# List of USERS with KEY2 last_used_date as N/A
|
|
LIST_USERS_KEY2_NA=$(for user in $LIST_USERS; do grep "^${user}," $TEMP_REPORT_FILE|awk -F, '{ print $1,$16 }'|grep N/A |awk '{ print $1 }' ; done)
|
|
LIST_USERS_KEY2_ACTIVE=$(for user in $LIST_USERS_KEY2_NA; do grep "^${user}," $TEMP_REPORT_FILE|awk -F, '{ print $1,$14 }'|grep "true$" |awk '{ print $1 }' ; done)
|
|
if [[ $LIST_USERS_KEY2_ACTIVE ]]; then
|
|
for user in $LIST_USERS_KEY2_ACTIVE; do
|
|
textNotice "$user has never used Access Key 2"
|
|
done
|
|
else
|
|
textOK "No users found with Access Key 2 never used"
|
|
fi
|
|
}
|