【公有云】通过AWS Endpoint service & Endpoint 实现跨VPC请求收敛

背景

公司两个AWS VPC有互通的需求,分别是PROD-VPC和PCI-VPC。PCI是Payment Card Industry的简称,通常PCI-VPC部署支付后端服务。关于PCI的相关资料参考AWS PCI DSS,Payment Card Industry 数据安全标准。

PROD服务请求PCI服务是跨VPC访问,在当前架构中通过Transit Gateway(以下简称TGW)实现。如下图所示,当PROD APP子网的应用需要访问PCI APP子网的应用时,会经过Prod VPC Software GW, Transit Gateway,PCI Software GW(图中NLB做负载均衡),最终到PCI APP。其中,TGW相关的路由表明确了目标地址为10.1.0.0/18的请求被路由到PCI-VPC;PCI Software GW所在子网的NACL默认全开,Software GW中EC2的安全组对PROD-VPC的80,443请求全开。

【公有云】通过AWS Endpoint service & Endpoint 实现跨VPC请求收敛_第1张图片

显然,按照当前的路由规则和NACL,安全组配置。从PROD APP子网,Software GW子网的任意应用可以访问PCI区EC2的80,443端口。这是不满足PCI区安全审计的需求的,因此我们需要想办法收敛PROD-VPC到PCI-VPC的访问入口,进行更严格的访问控制。

方案

通过Endpoint service把PCI-VPC的Software GW作为一个服务暴露出来。通过Endpoint在PROD-VPC作为一个接入点,转发PROD服务请求到PCI区的Endpoint service。这样PROD至PCI的请求收敛到PROD-Endpoint至PCI-Endpoint service,方便在Endpoint上通过安全组做网络层面的控制,在Endpoint Service上做AWS账户,IAM用户的访问控制。如下图所示:
【公有云】通过AWS Endpoint service & Endpoint 实现跨VPC请求收敛_第2张图片
新方案搭建完成后即可关闭TGW。

创建资源

1)创建Endpoint services

首先创建PCI区的Endpoint Service,选择Load balancer type,AWS会列出该region的所有对应Load balancer。选择我们的目标NLB即可。
【公有云】通过AWS Endpoint service & Endpoint 实现跨VPC请求收敛_第3张图片

按需填写Require acceptance for endpoint,参考:Accept or reject connection requests。按需填写是否开启private DNS name,是否支持IPv4,IPv6以及所需的Tag

【公有云】通过AWS Endpoint service & Endpoint 实现跨VPC请求收敛_第4张图片
【公有云】通过AWS Endpoint service & Endpoint 实现跨VPC请求收敛_第5张图片

2)创建Endpoint

在Endpoint service的详情页创建Endpoint connection
在这里插入图片描述

选Other endpoint services,填入创建的Endpoint service name,并verify service。若存在Endpoint service, 则会显示 Service name verified。

​​【公有云】通过AWS Endpoint service & Endpoint 实现跨VPC请求收敛_第6张图片

选择需要创建Endpoint的vpc,AZ,子网。选择附加到endpoint上的安全组。

【公有云】通过AWS Endpoint service & Endpoint 实现跨VPC请求收敛_第7张图片

创建 Endpoint。

在这里插入图片描述

创建完成后,可以在Endpoint service的Endpoint connections tab看到刚刚创建并关联的Endpoint

在这里插入图片描述

用户可以通过Endpoint,Details tab中的DNS names访问此endpoint;也可以通过Endpoint-Subnets tab中的IP addresss访问Endpoint

【公有云】通过AWS Endpoint service & Endpoint 实现跨VPC请求收敛_第8张图片

【公有云】通过AWS Endpoint service & Endpoint 实现跨VPC请求收敛_第9张图片

访问控制

1)安全组(Endpoint)

在Endpoint的Security Groups tab,可以添加安全组,对进出inbound, outbound请求做限制。
【公有云】通过AWS Endpoint service & Endpoint 实现跨VPC请求收敛_第10张图片

2)Allow principals(Endpoint service)

在Endpoint service的 Allow principals tab,可以添加principals以控制哪些账户可以通过Endpoints请求该Endpoint service(用在跨Account/Role/User访问场景)。参考:https://docs.aws.amazon.com/vpc/latest/privatelink/configure-endpoint-service.html#add-remove-permissions
【公有云】通过AWS Endpoint service & Endpoint 实现跨VPC请求收敛_第11张图片

总结

至此,我们将PROD VPC -> PCI VPC的请求都收敛到PROD VPC内的Endpoint。能够通过Endpoint安全组,Endpoint Service Allow principals对请求进行访问控制。消除了PROD区任意服务可访问PCI区EC2 80,443端口的安全隐患。满足了PCI区安全审计的要求。架构如图所示:【公有云】通过AWS Endpoint service & Endpoint 实现跨VPC请求收敛_第12张图片

附录

AWS PrivateLink Concepts:https://docs.aws.amazon.com/vpc/latest/privatelink/concepts.html

你可能感兴趣的:(云,安全,ops,linux,云计算,aws)