#!/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. CHECK_ID_extra7114="7.114" CHECK_TITLE_extra7114="[extra7114] Check if Glue development endpoints have S3 encryption enabled." CHECK_SCORED_extra7114="NOT_SCORED" CHECK_TYPE_extra7114="EXTRA" CHECK_SEVERITY_extra7114="Medium" CHECK_ASFF_RESOURCE_TYPE_extra7114="AwsGlue" CHECK_ALTERNATE_check7114="extra7114" CHECK_SERVICENAME_extra7114="glue" CHECK_RISK_extra7114='Data exfiltration could happen if information is not protected. KMS keys provide additional security level to IAM policies.' CHECK_REMEDIATION_extra7114='Specify AWS KMS keys to use for input and output from S3 and EBS.' CHECK_DOC_extra7114='https://docs.aws.amazon.com/glue/latest/dg/encryption-security-configuration.html' CHECK_CAF_EPIC_extra7114='Data Protection' extra7114(){ for regx in $REGIONS; do LIST_EP_SC=$($AWSCLI glue get-dev-endpoints $PROFILE_OPT --region $regx --query 'DevEndpoints[*].{Name:EndpointName,Security:SecurityConfiguration}' --output json) if [[ $LIST_EP_SC != '[]' ]]; then for ep in $(echo "${LIST_EP_SC}"| jq -r '.[] | @base64');do ENDPOINT_NAME=$(echo $ep | base64 --decode | jq -r '.Name') ENDPOINT_SC=$(echo $ep | base64 --decode | jq -r '.Security // empty') if [[ ! -z "$ENDPOINT_SC" ]]; then ENDPOINT_SC_ENCRYPTION=$($AWSCLI glue get-security-configuration --name "${ENDPOINT_SC}" $PROFILE_OPT --region $regx --query 'SecurityConfiguration.EncryptionConfiguration.S3Encryption[0].S3EncryptionMode' --output text) if [[ "$ENDPOINT_SC_ENCRYPTION" == "DISABLED" ]]; then textFail "$regx: Glue development endpoint $ENDPOINT_NAME does not have S3 encryption enabled!" "$regx" "$ENDPOINT_NAME" else textPass "$regx: Glue development endpoint $ENDPOINT_NAME has S3 encryption enabled" "$regx" "$ENDPOINT_NAME" fi else textFail "$regx: Glue development endpoint $ENDPOINT_NAME does not have security configuration" "$regx" "$ENDPOINT_NAME" fi done else textInfo "$regx: There are no Glue development endpoints" "$regx" fi done }