首页 > 解决方案 > Google Cloud VPC 配置:隔离后端服务器的防火墙规则

问题描述

这是我的设置以及我要完成的工作-

我有一个前端服务器 [FE],后端服务器 [BE]。我正在尝试设置自己的 VPC。FE和BE在同一个Region的不同Zone。FE 有自己的服务账号——fe-sa,BE 有自己的服务账号——be-sa。

通过阅读文档,我了解我们可以根据服务帐户设置防火墙规则,以允许/拒绝访问一组实例。

我试过切换目标和过滤器,但没有帮助。我尝试用 FE 服务器 IP 替换过滤器 - 这似乎有效(但我知道这不是正确的方法)我也尝试删除所有内容并尝试重新尝试

 Name       Type     Target  Filters    Protocol    Action  Priority
 fe-to-be   Ingress  be-sa   fe-sa      icmp        ALLOW   999

 where,  
 be-sa - is the Service account associated with Back end. 
 fe-sa - is the service account associated with Front end.

Below are complete list of other Firewall Rules, which work as expected:
Name                Type     Target        Filters  Protocol    Action  Priority
be-disable-internet egress   be-sa         0.0.0.0/0    icmp    DENY    1000
fe-enable-internet  egress   fe-sa         0.0.0.0/0    icmp    ALLOW   1000
allow-ssh-for-all   ingress  open-ssh-tag  0.0.0.0/0    tcp 22  ALLOW   1000
fe-incoming         ingress  fe-sa         0.0.0.0/0    icmp    ALLOW   1000

然而,这似乎阻止了所有来自任何来源(内部和外部 IP)的对 BE 的传入请求。

我希望来自 FE -> BE 的成功 ping 以及来自本地笔记本电脑的 ping -> 被阻止。

目前使用上述规则,我看到 FE -> BE 和笔记本电脑 -> BE 都被阻止。

标签: google-cloud-platformvpcweb-application-firewall

解决方案


推荐阅读