mirror of
https://github.com/ghndrx/prowler.git
synced 2026-02-11 07:15:15 +00:00
53 lines
2.6 KiB
Bash
53 lines
2.6 KiB
Bash
#!/usr/bin/env bash
|
|
|
|
# Prowler - the handy cloud security tool (copyright 2019) 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_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_SEVERITY_check29="Medium"
|
|
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"
|
|
CHECK_ASFF_COMPLIANCE_TYPE_check29="ens-op.mon.1.aws.flow.1"
|
|
CHECK_SERVICENAME_check29="vpc"
|
|
CHECK_RISK_check29='PC Flow Logs provide visibility into network traffic that traverses the VPC and can be used to detect anomalous traffic or insight during security workflows.'
|
|
CHECK_REMEDIATION_check29='It is recommended that VPC Flow Logs be enabled for packet "Rejects" for VPCs. '
|
|
CHECK_DOC_check29='http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/flow-logs.html '
|
|
CHECK_CAF_EPIC_check29='Logging and Monitoring'
|
|
|
|
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 2>&1)
|
|
if [[ $(echo "$AVAILABLE_VPC" | grep AccessDenied) ]]; then
|
|
textFail "$regx: Access Denied trying to describe VPCs"
|
|
continue
|
|
fi
|
|
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 2>&1)
|
|
if [[ $(echo "$CHECK_FL" | grep AccessDenied) ]]; then
|
|
textFail "$regx: VPC $vpcx Access Denied trying to describe flow logs" "$regx" "$vpcx"
|
|
continue
|
|
fi
|
|
if [[ $CHECK_FL ]]; then
|
|
for FL in $CHECK_FL; do
|
|
textPass "$regx: VPC $vpcx VPCFlowLog is enabled for LogGroupName: $FL" "$regx" "$vpcx"
|
|
done
|
|
else
|
|
textFail "$regx: VPC $vpcx VPCFlowLog is disabled" "$regx" "$vpcx"
|
|
fi
|
|
done
|
|
done
|
|
}
|