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_extra7167="7.167"
|
|
CHECK_TITLE_extra7167="[extra7167] Check if Cloudfront distributions are protected by AWS Shield Advanced"
|
|
CHECK_SCORED_extra7167="NOT_SCORED"
|
|
CHECK_CIS_LEVEL_extra7167="EXTRA"
|
|
CHECK_SEVERITY_extra7167="Medium"
|
|
CHECK_ASFF_RESOURCE_TYPE_extra7167="AwsCloudFrontDistribution"
|
|
CHECK_ALTERNATE_check7167="extra7167"
|
|
CHECK_SERVICENAME_extra7167="shield"
|
|
CHECK_RISK_extra7167='AWS Shield Advanced provides expanded DDoS attack protection for your resources'
|
|
CHECK_REMEDIATION_extra7167='Add as a protected resource in AWS Shield Advanced.'
|
|
CHECK_DOC_extra7167='https://docs.aws.amazon.com/waf/latest/developerguide/configure-new-protection.html'
|
|
CHECK_CAF_EPIC_extra7167='Infrastructure security'
|
|
|
|
extra7167() {
|
|
if [[ "$($AWSCLI $PROFILE_OPT shield get-subscription-state --output text)" == "ACTIVE" ]]; then
|
|
LIST_OF_CLOUDFRONT_DISTRIBUTIONS=$($AWSCLI cloudfront list-distributions $PROFILE_OPT --query 'DistributionList.Items[*].[Id,ARN]' --output text | grep -v None)
|
|
if [[ $LIST_OF_CLOUDFRONT_DISTRIBUTIONS ]]; then
|
|
while read -r distribution; do
|
|
DISTRIBUTION_ID=$(echo $distribution | awk '{ print $1; }')
|
|
DISTRIBUTION_ARN=$(echo $distribution | awk '{ print $2; }')
|
|
if $AWSCLI $PROFILE_OPT shield describe-protection --resource-arn $DISTRIBUTION_ARN >/dev/null 2>&1; then
|
|
textPass "$REGION: Cloudfront distribution $DISTRIBUTION_ID is protected by AWS Shield Advanced" "$REGION" "$DISTRIBUTION_ID"
|
|
else
|
|
textFail "$REGION: Cloudfront distribution $DISTRIBUTION_ID is not protected by AWS Shield Advanced" "$REGION" "$DISTRIBUTION_ID"
|
|
fi
|
|
done <<<"$LIST_OF_CLOUDFRONT_DISTRIBUTIONS"
|
|
else
|
|
textInfo "$REGION: no Cloudfront distributions found" "$REGION"
|
|
fi
|
|
else
|
|
textInfo "No AWS Shield Advanced subscription found. Skipping check."
|
|
fi
|
|
}
|