mirror of
https://github.com/ghndrx/prowler.git
synced 2026-02-10 14:55:00 +00:00
30 lines
1.5 KiB
Plaintext
30 lines
1.5 KiB
Plaintext
CHECK_ID_check118="1.18"
|
|
CHECK_TITLE_check118="[check118] Ensure IAM Master and IAM Manager roles are active (Scored)"
|
|
CHECK_SCORED_check118="SCORED"
|
|
CHECK_ALTERNATE_check118="check118"
|
|
|
|
check118(){
|
|
# "Ensure IAM Master and IAM Manager roles are active (Scored)"
|
|
FINDMASTERANDMANAGER=$($AWSCLI iam list-roles $PROFILE_OPT --region $REGION --query "Roles[*].{RoleName:RoleName}" --output text | grep -E 'Master|Manager'| tr '
|
|
' ' ')
|
|
if [[ $FINDMASTERANDMANAGER ]];then
|
|
textInfo "Found next roles as possible IAM Master and IAM Manager candidates: "
|
|
textInfo "$FINDMASTERANDMANAGER "
|
|
textInfo "run the commands below to check their policies with section 1.18 in the guide..."
|
|
for role in $FINDMASTERANDMANAGER;do
|
|
# find inline policies in found roles
|
|
INLINEPOLICIES=$($AWSCLI iam list-role-policies --role-name $role $PROFILE_OPT --region $REGION --query "PolicyNames[*]" --output text)
|
|
for policy in $INLINEPOLICIES;do
|
|
textInfo "INLINE: $AWSCLI iam get-role-policy --role-name $role --policy-name $policy $PROFILE_OPT --region $REGION --output json"
|
|
done
|
|
# find attached policies in found roles
|
|
ATTACHEDPOLICIES=$($AWSCLI iam list-attached-role-policies --role-name $role $PROFILE_OPT --region $REGION --query "AttachedPolicies[*]" --output text)
|
|
for policy in $ATTACHEDPOLICIES;do
|
|
textInfo "ATTACHED: $AWSCLI iam get-role-policy --role-name $role --policy-name $policy $PROFILE_OPT --region $REGION --output json"
|
|
done
|
|
done
|
|
else
|
|
textFail "IAM Master and IAM Manager roles not found"
|
|
fi
|
|
}
|