VPC flow logging is enabled for all VPCs
Alibaba Cloud VPC Flow Logs capture IP traffic information for Elastic Network Interfaces, VSwitches, or entire VPCs. When a flow log is created for a VPC, all ENIs within it, including newly created ones, are automatically monitored. Flow log data is stored in Log Service where it can be viewed and analyzed for security and operational purposes.
Risk
Without VPC Flow Logs enabled, there is no visibility into network traffic traversing the VPC. This prevents detection of anomalous traffic patterns, unauthorized network connections, and data exfiltration attempts, and severely limits the ability to investigate network-based security incidents.
Run this check with Prowler
Run in Prowler Cloudprowler alibabacloud --checks vpc_flow_logs_enabledRecommendation
Enable VPC Flow Logs for all VPCs to capture IP traffic information and store it in Log Service for security analysis, anomaly detection, and incident response.
Remediation
CLI
aliyun vpc CreateFlowLog --ResourceId <vpc_id> --ResourceType VPC --FlowLogName <flow_log_name> --LogStoreName <log_store_name> --ProjectName <project_name>Terraform
resource "alicloud_vpc_flow_log" "example" {
flow_log_name = "example-flow-log"
resource_type = "VPC"
resource_id = alicloud_vpc.example.id
traffic_type = "All"
project_name = alicloud_log_project.example.project_name
log_store_name = alicloud_log_store.example.logstore_name
}Other
Check Code
from prowler.lib.check.models import Check, CheckReportAlibabaCloud
from prowler.providers.alibabacloud.services.vpc.vpc_client import vpc_client
class vpc_flow_logs_enabled(Check):
"""Check if VPC flow logging is enabled in all VPCs."""
def execute(self) -> list[CheckReportAlibabaCloud]:
findings = []
for vpc in vpc_client.vpcs.values():
report = CheckReportAlibabaCloud(metadata=self.metadata(), resource=vpc)
report.region = vpc.region
report.resource_id = vpc.id
report.resource_arn = (
f"acs:vpc:{vpc.region}:{vpc_client.audited_account}:vpc/{vpc.id}"
)
if vpc.flow_log_enabled:
report.status = "PASS"
report.status_extended = (
f"VPC {vpc.name if vpc.name else vpc.id} has flow logs enabled."
)
else:
report.status = "FAIL"
report.status_extended = f"VPC {vpc.name if vpc.name else vpc.id} does not have flow logs enabled."
findings.append(report)
return findings