mirror of
https://github.com/ghndrx/prowler.git
synced 2026-02-10 14:55:00 +00:00
prowler: fix IAM role detection and curl error
Related to https://github.com/toniblyx/prowler/pull/200 If the ec2 instance is not attached to an IAM role, the `curl -s -m 1 http://169.254.169.254/latest/meta-data/iam/security-credentials` will return a 404 page instead of null, INSTANCE_PROFILE will always be true and result to curl error when trying to use default cli profile: curl: option -: is unknown curl: try 'curl --help' or 'curl --manual' for more information
This commit is contained in:
3
prowler
3
prowler
@@ -250,6 +250,9 @@ fi
|
||||
# instance profile (metadata server) if runs in an EC2 instance
|
||||
|
||||
INSTANCE_PROFILE=$(curl -s -m 1 http://169.254.169.254/latest/meta-data/iam/security-credentials/)
|
||||
if echo "$INSTANCE_PROFILE" | grep -q '404 - Not Found'; then
|
||||
INSTANCE_PROFILE=
|
||||
fi
|
||||
|
||||
if [[ $PROFILE ]]; then
|
||||
PROFILE_OPT="--profile $PROFILE"
|
||||
|
||||
Reference in New Issue
Block a user