Google Compute network using firewall rule that allows port range
이 페이지는 아직 한국어로 제공되지 않습니다. 번역 작업 중입니다.
현재 번역 프로젝트에 대한 질문이나 피드백이 있으신 경우
언제든지 연락주시기 바랍니다.Id: e6f61c37-106b-449f-a5bb-81bfcaceb8b4
Cloud Provider: GCP
Platform: Terraform
Severity: Low
Category: Networking and Firewall
Learn More
Description
Allowing a port range in a Google Compute Network firewall rule, such as ports = ["80", "8080", "1000-2000"], can expose unnecessary services and increase the attack surface of your cloud environment. Attackers may exploit any open ports within the specified range, leading to potential unauthorized access or compromise of resources. To reduce risk, firewall rules should restrict access to only required ports, as shown in the following configuration:
allow {
protocol = "tcp"
ports = ["80", "8080"]
}
Compliant Code Examples
resource "google_compute_firewall" "negative1" {
name = "test-firewall"
network = google_compute_network.negative1.name
allow {
protocol = "icmp"
}
allow {
protocol = "tcp"
ports = ["80", "8080"]
}
source_tags = ["web"]
}
resource "google_compute_network" "negative1" {
name = "test-network"
}
Non-Compliant Code Examples
resource "google_compute_firewall" "positive1" {
name = "test-firewall"
network = google_compute_network.positive1.name
allow {
protocol = "icmp"
}
allow {
protocol = "tcp"
ports = ["80", "8080", "1000-2000"]
}
source_tags = ["web"]
}
resource "google_compute_network" "positive1" {
name = "test-network"
}