mirror of
https://github.com/prowler-cloud/prowler.git
synced 2026-10-24 20:34:16 +00:00
New check 7167 Cloudfront distributions are protected by AWS Shield Advanced
This commit is contained in:
1 parent
7690cb5f98
commit
4aa4c95d22
1 file changed
+46
@@ -0,0 +1,46 @@
|
||||
#!/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"
|
||||
CHECK_SCORED_extra7167="NOT_SCORED"
|
||||
CHECK_CIS_LEVEL_extra7167="EXTRA"
|
||||
CHECK_SEVERITY_check="Medium"
|
||||
CHECK_ASFF_RESOURCE_TYPE_extra7167="AwsCloudFrontDistribution"
|
||||
CHECK_ALTERNATE_extra7167="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 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)
|
||||
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 aws 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
|
||||
textPass "$REGION: no Cloudfront distributions found" "$REGION"
|
||||
fi
|
||||
else
|
||||
textInfo "No AWS Shield Advanced subscription found. Skipping check."
|
||||
fi
|
||||
}
|
||||
Reference in new issue
Block a user