mirror of
https://github.com/ghndrx/prowler.git
synced 2026-02-10 23:05:05 +00:00
region and profile handling improved
This commit is contained in:
@@ -17,6 +17,9 @@
|
||||
# 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"
|
||||
@@ -32,3 +35,13 @@ else
|
||||
PROFILE="default"
|
||||
PROFILE_OPT="--profile $PROFILE"
|
||||
fi
|
||||
|
||||
# Set default region by aws config, fall back to us-east-1
|
||||
REGION_CONFIG=$(aws configure get region)
|
||||
if [[ $REGION_OPT ]]; then
|
||||
REGION="$REGION_OPT"
|
||||
elif [[ $REGION_CONFIG ]]; then
|
||||
REGION="$REGION_CONFIG"
|
||||
else
|
||||
REGION="us-east-1"
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user