설명
cidr_blocks와 ipv6_cidr_blocks를 각각 확인하세요. TCP 80에 0.0.0.0/0과 ::/0을 허용하면 경로가 있는 모든 IPv4·IPv6 클라이언트가 수신 서비스에 접속할 수 있습니다.
잠재적 영향
HTTP는 요청과 응답을 평문으로 보냅니다. HTTPS로 리디렉션해도 최초 HTTP 요청은 이미 전송됩니다.
해결 방법
애플리케이션이나 로드 밸런서에 HTTPS를 구성하고 불필요한 TCP 80 허용을 제거하세요. HTTP가 필요하면 두 변수에 승인된 출발지 대역을 지정하고 클라이언트 접속을 확인하세요.
예시
두 예시는 allow_tls라는 이름을 사용하지만 TLS를 구성하지 않습니다. 기존 그룹의 규칙만 줄일 때는 그룹 자체의 description을 유지하세요. 이 값까지 바꾸면 Terraform이 그룹을 교체합니다.
변경 전
hcl
resource "aws_security_group" "example" {
name = "allow_tls"
description = "HTTP port open"
ingress {
description = "HTTP port open"
from_port = 80
to_port = 80
protocol = "tcp"
cidr_blocks = ["0.0.0.0/0"]
ipv6_cidr_blocks = ["::/0"]
}
}
변경 후
hcl
resource "aws_security_group" "example" {
name = "allow_tls"
description = "sample"
ingress {
description = "sample"
from_port = 80
to_port = 80
protocol = "tcp"
cidr_blocks = var.approved_ipv4_cidrs
ipv6_cidr_blocks = var.approved_ipv6_cidrs
}
}