mirror of
https://github.com/prowler-cloud/prowler.git
synced 2025-12-19 05:17:47 +00:00
32 lines
1.3 KiB
Bash
32 lines
1.3 KiB
Bash
#!/usr/bin/env bash
|
|
|
|
# Prowler - the handy cloud security tool (c) by Toni de la Fuente
|
|
#
|
|
# This Prowler check is licensed under a
|
|
# Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
|
|
#
|
|
# You should have received a copy of the license along with this
|
|
# work. If not, see <http://creativecommons.org/licenses/by-nc-sa/4.0/>.
|
|
|
|
CHECK_ID_check22="2.2,2.02"
|
|
CHECK_TITLE_check22="[check22] Ensure CloudTrail log file validation is enabled (Scored)"
|
|
CHECK_SCORED_check22="SCORED"
|
|
CHECK_ALTERNATE_check202="check22"
|
|
|
|
check22(){
|
|
# "Ensure CloudTrail log file validation is enabled (Scored)"
|
|
LIST_OF_TRAILS=$($AWSCLI cloudtrail describe-trails $PROFILE_OPT --region $REGION --query 'trailList[*].Name' --output text)
|
|
if [[ $LIST_OF_TRAILS ]];then
|
|
for trail in $LIST_OF_TRAILS;do
|
|
LOGFILEVALIDATION_TRAIL_STATUS=$($AWSCLI cloudtrail describe-trails $PROFILE_OPT --region $REGION --query 'trailList[*].LogFileValidationEnabled' --output text --trail-name-list $trail)
|
|
if [[ "$LOGFILEVALIDATION_TRAIL_STATUS" == 'False' ]];then
|
|
textFail "$trail trail in $REGION has not log file validation enabled"
|
|
else
|
|
textPass "$trail trail in $REGION has log file validation enabled"
|
|
fi
|
|
done
|
|
else
|
|
textFail "No CloudTrail trails found!"
|
|
fi
|
|
}
|