Hack. Eat. Sleep. Repeat!!!
cloudgoat create iam_enum_basics
Enumerate attached managed policies and read their metadata-:
User-:
aws iam list-users --profile bob | jq
aws iam list-groups --profile bob | jq
aws iam list-roles --profile bob | jq
aws iam list-groups-for-user --user-name <u> --profile <p>
aws iam list-roles --profile <u> --query "Roles[*].[RoleName,Path]" --output table
Roles explanation-: Resource Explorer (Resource discovery and indexing) AWS SUPPORT: (Enabling Support Related Diagnostics and Indexing) Trusted Advisor (Allowing automated health and best practice checks)
aws iam list-user-policies --user-name <u> --profile <p>
aws iam list-attached-user-policies --user-name <u> --profile <p>
#Inline group policies
aws iam list-group-policies --group-name <u> --profile <p>
#attached group policies
aws iam list-attached-group-policies --group-name <u> --profile <p>
#Inline role policies
aws iam list-role-policies --role-name <u> --profile <p>
#attached role policies
aws iam list-attached-role-policies --role-name <u> --profile <p>
cg-bob-* as well as one one role policy for role cg-flag4-role-*#Metadata about a managed Iam policy
aws iam get-policy --policy-arn <arn> --profile <p>
# Get Json policy document
aws iam get-policy-version --policy-arn <arn> --version-id <v> --profile <p>
aws iam get-user-policy --user-name <u> --policy-name <p> --profile <p>
aws iam get-group-policy --group-name <u> --policy-name <p> --profile <p>
aws iam get-role-policy --role-name <u> --policy-name <p> --profile <p>
aws iam get-role --role-name cg-flag4-role-c --profile bob | jq
aws iam get-user --user-name cg-bob-c --profile bob | jq
aws iam get-group --group-name cg-bob- --profile bob | jq