mirror of
https://github.com/ghndrx/prowler.git
synced 2026-02-10 06:45:08 +00:00
47 lines
2.4 KiB
Bash
47 lines
2.4 KiB
Bash
#!/usr/bin/env bash
|
|
|
|
# Prowler - the handy cloud security tool (copyright 2019) by Toni de la Fuente
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
|
# use this file except in compliance with the License. You may obtain a copy
|
|
# of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software distributed
|
|
# under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
|
# CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
|
# specific language governing permissions and limitations under the License.
|
|
|
|
CHECK_ID_extra7169="7.169"
|
|
CHECK_TITLE_extra7169="[extra7169] Check if global accelerators are protected by AWS Shield Advanced"
|
|
CHECK_SCORED_extra7169="NOT_SCORED"
|
|
CHECK_CIS_LEVEL_extra7169="EXTRA"
|
|
CHECK_SEVERITY_extra7169="Medium"
|
|
CHECK_ASFF_RESOURCE_TYPE_extra7169="AwsGlobalAccelerator"
|
|
CHECK_ALTERNATE_check7169="extra7169"
|
|
CHECK_SERVICENAME_extra7169="shield"
|
|
CHECK_RISK_extra7169='AWS Shield Advanced provides expanded DDoS attack protection for your resources'
|
|
CHECK_REMEDIATION_extra7169='Add as a protected resource in AWS Shield Advanced.'
|
|
CHECK_DOC_extra7169='https://docs.aws.amazon.com/waf/latest/developerguide/configure-new-protection.html'
|
|
CHECK_CAF_EPIC_extra7169='Infrastructure security'
|
|
|
|
extra7169() {
|
|
if [[ "$($AWSCLI $PROFILE_OPT shield get-subscription-state --output text)" == "ACTIVE" ]]; then
|
|
LIST_OF_GLOBAL_ACCELERATORS=$($AWSCLI globalaccelerator list-accelerators --region us-west-2 $PROFILE_OPT --query 'Accelerators[?Enabled].[Name,AcceleratorArn]' --output text)
|
|
if [[ $LIST_OF_GLOBAL_ACCELERATORS ]]; then
|
|
while read -r accelerator; do
|
|
ACCELERATOR_NAME=$(echo $accelerator | awk '{ print $1; }')
|
|
ACCELERATOR_ARN=$(echo $accelerator | awk '{ print $2; }')
|
|
if $AWSCLI $PROFILE_OPT shield describe-protection --resource-arn $ACCELERATOR_ARN >/dev/null 2>&1; then
|
|
textPass "$REGION: Global Accelerator $ACCELERATOR_NAME is protected by AWS Shield Advanced" "$REGION" "$ACCELERATOR_NAME"
|
|
else
|
|
textFail "$REGION: Global Accelerator $ACCELERATOR_NAME is not protected by AWS Shield Advanced" "$REGION" "$ACCELERATOR_NAME"
|
|
fi
|
|
done <<<"$LIST_OF_GLOBAL_ACCELERATORS"
|
|
else
|
|
textInfo "$REGION: no global accelerators found" "$REGION"
|
|
fi
|
|
else
|
|
textInfo "No AWS Shield Advanced subscription found. Skipping check."
|
|
fi
|
|
}
|