mirror of
https://github.com/ghndrx/prowler.git
synced 2026-02-11 07:15:15 +00:00
Remove the second entry in any comma-separated check IDs from each check, formatting the check ID with leading zeros in `include/outputs` if the `-n` flag is active
35 lines
1.4 KiB
Bash
35 lines
1.4 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_check29="2.9"
|
|
CHECK_TITLE_check29="[check29] Ensure VPC Flow Logging is Enabled in all VPCs (Scored)"
|
|
CHECK_SCORED_check29="SCORED"
|
|
CHECK_TYPE_check29="LEVEL2"
|
|
CHECK_ASFF_TYPE_check29="Software and Configuration Checks/Industry and Regulatory Standards/CIS AWS Foundations Benchmark"
|
|
CHECK_ASFF_RESOURCE_TYPE_check29="AwsEc2Vpc"
|
|
CHECK_ALTERNATE_check209="check29"
|
|
|
|
check29(){
|
|
# "Ensure VPC Flow Logging is Enabled in all VPCs (Scored)"
|
|
for regx in $REGIONS; do
|
|
AVAILABLE_VPC=$($AWSCLI ec2 describe-vpcs $PROFILE_OPT --region $regx --query 'Vpcs[?State==`available`].VpcId' --output text)
|
|
for vpcx in $AVAILABLE_VPC; do
|
|
CHECK_FL=$($AWSCLI ec2 describe-flow-logs $PROFILE_OPT --region $regx --filter Name="resource-id",Values="${vpcx}" --query 'FlowLogs[?FlowLogStatus==`ACTIVE`].FlowLogId' --output text)
|
|
if [[ $CHECK_FL ]];then
|
|
for FL in $CHECK_FL;do
|
|
textPass "VPC $vpcx: VPCFlowLog is enabled for LogGroupName: $FL in Region $regx" "$regx"
|
|
done
|
|
else
|
|
textFail "VPC $vpcx: No VPCFlowLog has been found in Region $regx" "$regx"
|
|
fi
|
|
done
|
|
done
|
|
}
|