mirror of
https://github.com/ghndrx/prowler.git
synced 2026-02-10 23:05:05 +00:00
55 lines
3.1 KiB
Bash
55 lines
3.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.
|
|
CHECK_ID_extra7118="7.118"
|
|
CHECK_TITLE_extra7118="[extra7118] Check if Glue ETL Jobs have S3 encryption enabled."
|
|
CHECK_SCORED_extra7118="NOT_SCORED"
|
|
CHECK_CIS_LEVEL_extra7118="EXTRA"
|
|
CHECK_SEVERITY_extra7118="Medium"
|
|
CHECK_ASFF_RESOURCE_TYPE_extra7118="AwsGlue"
|
|
CHECK_ALTERNATE_check7118="extra7118"
|
|
CHECK_SERVICENAME_extra7118="glue"
|
|
CHECK_RISK_extra7118='If not enabled sensitive information at rest is not protected.'
|
|
CHECK_REMEDIATION_extra7118='Provide the encryption properties that are used by crawlers; jobs; and development endpoints.'
|
|
CHECK_DOC_extra7118='https://docs.aws.amazon.com/glue/latest/dg/console-security-configurations.html'
|
|
CHECK_CAF_EPIC_extra7118='Data Protection'
|
|
|
|
extra7118(){
|
|
for regx in $REGIONS; do
|
|
JOB_LIST=$($AWSCLI glue get-jobs $PROFILE_OPT --region $regx --output json --query 'Jobs[*].{Name:Name,SecurityConfiguration:SecurityConfiguration,JobEncryption:DefaultArguments."--encryption-type"}')
|
|
if [[ $JOB_LIST != '[]' ]]; then
|
|
for job in $(echo "${JOB_LIST}" | jq -r '.[] | @base64'); do
|
|
JOB_NAME=$(echo $job | base64 --decode | jq -r '.Name')
|
|
SECURITY_CONFIGURATION=$(echo $job | base64 --decode | jq -r '.SecurityConfiguration // empty')
|
|
JOB_ENCRYPTION=$(echo $job | base64 --decode | jq -r '.JobEncryption // empty')
|
|
if [[ ! -z "$SECURITY_CONFIGURATION" ]]; then
|
|
S3_ENCRYPTION=$($AWSCLI glue get-security-configuration --name "${SECURITY_CONFIGURATION}" $PROFILE_OPT --region $regx --output text --query 'SecurityConfiguration.EncryptionConfiguration.S3Encryption[0].S3EncryptionMode')
|
|
if [[ "$S3_ENCRYPTION" == "DISABLED" ]]; then
|
|
if [[ ! -z "$JOB_ENCRYPTION" ]]; then
|
|
textPass "$regx: Glue job $JOB_NAME does have $JOB_ENCRYPTION for S3 encryption enabled" "$regx" "$JOB_NAME"
|
|
else
|
|
textFail "$regx: Glue job $JOB_NAME does not have S3 encryption enabled" "$regx" "$JOB_NAME"
|
|
fi
|
|
else
|
|
textPass "$regx: Glue job $JOB_NAME does have $S3_ENCRYPTION for S3 encryption enabled" "$regx" "$JOB_NAME"
|
|
fi
|
|
elif [[ ! -z "$JOB_ENCRYPTION" ]]; then
|
|
textPass "$regx: Glue job $JOB_NAME does have $JOB_ENCRYPTION for S3 encryption enabled" "$regx" "$JOB_NAME"
|
|
else
|
|
textFail "$regx: Glue job $JOB_NAME does not have S3 encryption enabled" "$regx" "$JOB_NAME"
|
|
fi
|
|
done
|
|
else
|
|
textInfo "$regx: There are no Glue jobs" "$regx"
|
|
fi
|
|
done
|
|
} |