mirror of
https://github.com/ghndrx/prowler.git
synced 2026-02-11 15:25:10 +00:00
48 lines
2.4 KiB
Bash
48 lines
2.4 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_extra7161="7.161"
|
|
CHECK_TITLE_extra7161="[extra7161] Check if EFS protects sensitive data with encryption at rest"
|
|
CHECK_SCORED_extra7161="NOT_SCORED"
|
|
CHECK_CIS_LEVEL_extra7161="EXTRA"
|
|
CHECK_SEVERITY_extra7161="Medium"
|
|
CHECK_ASFF_RESOURCE_TYPE_extra7161="AwsEfsFileSystem"
|
|
CHECK_ALTERNATE_check7161="extra7161"
|
|
CHECK_SERVICENAME_extra7161="efs"
|
|
CHECK_RISK_extra7161='EFS should be encrypted at rest to prevent exposure of sensitive data to bad actors'
|
|
CHECK_REMEDIATION_extra7161='Ensure that encryption at rest is enabled for EFS file systems. Encryption at rest can only be enabled during the file system creation.'
|
|
CHECK_DOC_extra7161='https://docs.aws.amazon.com/efs/latest/ug/encryption-at-rest.html'
|
|
CHECK_CAF_EPIC_extra7161='Data Protection'
|
|
|
|
extra7161(){
|
|
# "Check if EFS has encryption at rest enabled (Not Scored) (Proposed requirement for 1.5 CIS benchmark)"
|
|
for regx in $REGIONS; do
|
|
LIST_OF_EFS_IDS=$($AWSCLI efs describe-file-systems $PROFILE_OPT --region $regx --query 'FileSystems[*].FileSystemId' --output text 2>&1| xargs -n1 )
|
|
if [[ $(echo "$LIST_OF_EFS_IDS" | grep -E 'AccessDenied|UnauthorizedOperation|AuthorizationError') ]]; then
|
|
textInfo "$regx: Access Denied trying to describe file systems" "$regx"
|
|
continue
|
|
fi
|
|
if [[ $LIST_OF_EFS_IDS ]]; then
|
|
for efsId in $LIST_OF_EFS_IDS;do
|
|
EFS_ENCRYPTION_CHECK=$($AWSCLI efs $PROFILE_OPT describe-file-systems --region $regx --file-system-id $efsId --output json --query 'FileSystems[*].Encrypted' --output text)
|
|
if [[ $EFS_ENCRYPTION_CHECK == "True" ]]; then
|
|
textPass "$regx: EFS $efsId has has encryption at rest enabled" "$regx" "$efsId"
|
|
else
|
|
textFail "$regx: EFS: $efsId does not have encryption at rest enabled" "$regx" "$efsId"
|
|
fi
|
|
done
|
|
else
|
|
textInfo "$regx: No EFS found" "$regx"
|
|
fi
|
|
done
|
|
}
|