【问题标题】:Connect to Compute Engine From App Engine or CLoud Run with firewall and IAP使用防火墙和 IAP 从 App Engine 或 CLoud Run 连接到 Compute Engine
【发布时间】:2020-07-19 13:36:59
【问题描述】:

我有一个在 Google 计算引擎上运行的 SFTP 服务器。防火墙设置为允许来自身份感知代理的流量。

我可以在本地使用 gcloud ssh 连接到服务,但我无法从 App Engine 或 Cloud Run 连接。 Cloud Run 和 App Engine 的服务帐号已经拥有 IAP 隧道和 Https 权限。

后端使用ssh2-sftp-client在Node中编写。

如何保护 Compute Engine 并允许来自 Cloud Run 和 App Engine 端口 22 的 tcp 流量仍然通过?

【问题讨论】:

    标签: node.js google-app-engine google-compute-engine firewall identity-aware-proxy


    【解决方案1】:

    请看下面的更新。

    有两种可能的解决方法:

    无服务器 VPC 访问使您能够从 App Engine 应用程序进行连接 直接连接到 Compute Engine 虚拟机实例、Memorystore 实例、云 SQL 实例以及具有内部 IP 地址的任何其他资源。

    很遗憾,目前 Cloud Run 无法使用无服务器 VPC 访问(更多信息请参见文档 Services not yet supported),但您可以在 Google Public Issue Tracker 中加入 Feature Request,进行评论和跟踪进度。此外,App Engine Flex 也不提供此类服务。

    • 如果您使用 App Engine Flex 或 Cloud Run,请按照以下步骤操作:
    1. reserve 外部静态 IP
    2. create f1-micro 具有保留外部 IP 地址的 VM 实例(这可能适合 Compute Engine free tier
    3. create 允许从保留的外部 IP 连接到 SFTP 服务器的防火墙规则
    4. 通过运行一个 ssh 客户端来创建一个 SOCKS 代理,该客户端通过创建的 VM 路由流量,如 example
    5. configuressh2-sftp-client 使用 SOCKS 代理
    6. 连接到 SFTP

    更新:

    无需使用任何变通方法。 无服务器 VPC 访问现在可用于 Cloud Run。请查看documentation 了解更多详情。

    【讨论】:

    • 谢谢,我会调查的。看起来它会起作用我会在尝试后接受答案。
    • 无服务器 VPC 访问现已可用于 Cloud Run
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-05-28
    • 2018-04-28
    • 2021-04-14
    • 2020-04-18
    • 2020-12-18
    • 2018-09-16
    相关资源
    最近更新 更多