mirror of
https://github.com/ghndrx/prowler.git
synced 2026-02-10 14:55:00 +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
|
||||
|
||||
4
prowler
4
prowler
@@ -35,7 +35,7 @@ OPTNORMAL="[0;39m"
|
||||
PROWLER_VERSION=2.0-beta2
|
||||
PROWLER_DIR=$(dirname "$0")
|
||||
|
||||
REGION="us-east-1"
|
||||
REGION=""
|
||||
FILTERREGION=""
|
||||
MAXITEMS=100
|
||||
MONOCHROME=0
|
||||
@@ -92,7 +92,7 @@ while getopts ":hlkp:r:c:g:f:m:M:enb" OPTION; do
|
||||
PROFILE=$OPTARG
|
||||
;;
|
||||
r )
|
||||
REGION=$OPTARG
|
||||
REGION_OPT=$OPTARG
|
||||
;;
|
||||
c )
|
||||
CHECK_ID=$OPTARG
|
||||
|
||||
Reference in New Issue
Block a user