如何将 IP 白名单应用于 Openshift routes/services

How to apply IP whitelisting to Openshift routes/services

假设有两个域,一个 public,另一个仅限于几个选定的源 IP:

public.example.com   10.0.0.1
private.example.com  10.0.0.2

现在,白名单应用于外部防火墙,然后将请求传递到 Openshift 路由器。我发现,在 public 请求的 "host" header 中发送 "private" 域名就足以从 "private" 服务中实际获取内容:

curl https://public.example.com --header "host: private.example.com"

给我带来了我没想到会看到的内容。

我有哪些选择可以在网络级别上实际保护它?

您可以向路由添加注释以强制执行 IP 白名单。

metadata:
  annotations:
    haproxy.router.openshift.io/ip_whitelist: 192.168.1.10 192.168.1.11 192.168.1.12

https://docs.openshift.com/container-platform/3.9/architecture/networking/routes.html#whitelist