mirror of
https://github.com/ghndrx/prowler.git
synced 2026-02-11 07:15:15 +00:00
38 lines
1.9 KiB
Bash
38 lines
1.9 KiB
Bash
#!/usr/bin/env bash
|
|
|
|
# Prowler - the handy cloud security tool (copyright 2020) 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_extra7108="7.108"
|
|
CHECK_TITLE_extra7108="[extra7108] Check if Amazon SageMaker Training jobs have volume and output with KMS encryption enabled"
|
|
CHECK_SCORED_extra7108="NOT_SCORED"
|
|
CHECK_TYPE_extra7108="EXTRA"
|
|
CHECK_ASFF_RESOURCE_TYPE_extra7108="AwsSageMakerNotebookInstance"
|
|
CHECK_ALTERNATE_check7108="extra7108"
|
|
CHECK_SEVERITY_extra7108="Medium"
|
|
|
|
extra7108(){
|
|
for regx in ${REGIONS}; do
|
|
LIST_SM_NB_JOBS=$($AWSCLI $PROFILE_OPT --region $regx sagemaker list-training-jobs --query 'TrainingJobSummaries[*].TrainingJobName' --output text)
|
|
if [[ $LIST_SM_NB_JOBS ]];then
|
|
for nb_job_name in $LIST_SM_NB_JOBS; do
|
|
SM_JOB_KMSENCRYPTION=$($AWSCLI $PROFILE_OPT --region $regx sagemaker describe-training-job --training-job-name $nb_job_name --query 'ResourceConfig.VolumeKmsKeyId' --output text)
|
|
if [[ "${SM_JOB_KMSENCRYPTION}" == "None" ]];then
|
|
textFail "${regx}: Sagemaker Trainings job $nb_job_name has KMS encryption disabled" "${regx}"
|
|
else
|
|
textPass "${regx}: Sagemaker Trainings job $nb_job_name has KSM encryption enabled" "${regx}"
|
|
fi
|
|
done
|
|
else
|
|
textInfo "${regx}: No Sagemaker Trainings jobs found" "${regx}"
|
|
fi
|
|
done
|
|
} |