Files
prowler/checks/check_extra7125
2020-11-10 13:05:22 +01:00

51 lines
2.1 KiB
Bash

#!/usr/bin/env bash
# Prowler - the handy cloud security tool (copyright 2018) 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.
# Remediation:
#
# https://www.cloudconformity.com/knowledge-base/aws/RDS/instance-deletion-protection.html
# https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Overview.DBInstance.Modifying.html
#
# aws rds modify-db-instance \
# --region us-east-1 \
# --db-instance-identifier test-db \
# --deletion-protection \
# [--apply-immediately | --no-apply-immediately]
CHECK_ID_extra7125="7.125"
CHECK_TITLE_extra7125="[extra7125] Checks if AWS Glue is used with VPC Endpoints."
CHECK_SCORED_extra7125="NOT_SCORED"
CHECK_TYPE_extra7125="EXTRA"
CHECK_SEVERITY_extra7125="Medium"
CHECK_ASFF_RESOURCE_TYPE_extra7125="AwsGlue"
CHECK_ALTERNATE_check7125="extra7125"
extra7125(){
textInfo "Looking for Development Endpoints in all regions... "
for regx in $REGIONS; do
LIST_EP_PA=$($AWSCLI glue get-dev-endpoints $PROFILE_OPT --region $regx --query 'DevEndpoints[*].{Name:EndpointName,Address:PrivateAddress}' --output json)
if [[ ! -z "$LIST_EP_PA" ]]; then
for ep in $(echo "${LIST_EP_PA}" | jq -r '.[] | @base64'); do
EP_NAME=$(echo $ep | base64 --decode | jq -r '.Name')
PRIVATE_ADDRESS=$(echo $ep | base64 --decode | jq -r '.Address')
if [[ ! -z "$PRIVATE_ADDRESS" ]]; then
textFail "$regx: AWS Glue Development Endpoint $EP_NAME uses a VPC Endpoint" "$regx"
else
textPass "$regx: AWS Glue Development Endpoint $EP_NAME does not use a VPC Endpoint" "$regx"
fi
done
else
textInfo "$regx: No Development Endpoints found" "$regx"
fi
done
}