首页 > 解决方案 > 为什么我不能使用 VPC NACL 来加强安全性?

问题描述

我在 AWS 研究中遇到了以下场景问题:

您有一个在由应用程序负载均衡器 (ALB)、应用程序服务器和数据库组成的 VPC 中运行的企业对企业 Web 应用程序。您的 Web 应用程序应该只接受来自预定义客户 IP 地址的流量。哪两个选项满足此安全要求?选择 2 个答案

选项:

A.  Configure web server VPC security groups to allow traffic from your customers’ IPs
B.  Configure your web servers to filter traffic based on the ALB’s "X-forwarded-for" header
C.  Configure your web servers to filter traffic based on the ALB’s "Proxy Protocol" header
D.  Configure ELB security groups to allow traffic from your customers’ IPs and deny all outbound traffic
E.  Configure a VPC NACL to allow web traffic from your customers’ IPs and deny all outbound traffic 

正确答案

B. Configure your web servers to filter traffic based on the ALB’s "X-forwarded-for" header
D. Configure ELB security groups to allow traffic from your customers’ IPs and deny all outbound traffic

我的问题是为什么 E 在这里不是一个公认的答案?

非常感谢,感谢任何启发。

标签: amazon-web-servicessecurityvpcamazon-acl

解决方案


我相信 E 是无效的,因为答案的第二部分“并拒绝所有出站流量”。NACL 本质上是无状态的,这意味着在 NACL 中打开的入站流量默认情况下不允许请求的出站流量。因此,如果您的 Web 服务器在端口 80 上收到请求,它需要使用临时端口(范围在 1024-65535 范围内)进行响应。因此,您的 NACL 必须具有出站 ALLOW 规则才能在这些端口上发送响应。

这与本质上是有状态的安全组不同,并且不需要为临时端口明确允许。

如需进一步阅读,请在以下文档中搜索 stateless 以获得更好的理解,如果我无法在这里解释:

https://docs.aws.amazon.com/vpc/latest/userguide/vpc-network-acls.html


推荐阅读