【问题标题】:Postgres SSL Termination at AWS ELBAWS ELB 的 Postgres SSL 终止
【发布时间】:2020-10-12 23:32:39
【问题描述】:

是否可以在 AWS ELB 上终止 SSL 到 Postgres 服务器的前面,以使以下命令成功?

PGSSLMODE=verify-full \
PGSSLROOTCERT=/path/to/go-daddy-root-ca.pem \
PGCONNECT_TIMEOUT=5 \
psql -h my-postgres.example.com -p 5432 -U test_username test-database -c 'select 1';

如果我使用以下参数在 Postgres 服务上设置我的 ssl 证书和密钥,我可以在负载均衡器上使用 TCP 协议,并在实例协议上使用 TCP:

-c
ssl=on
-c
ssl_cert_file=/var/lib/postgresql/my-postgres.example.com.crt
-c
ssl_key_file=/var/lib/postgresql/my-postgres.example.com.key

但是,如果可能,我想在负载均衡器级别处理 SSL,以免将证书和密钥传递到运行 postgres 服务的实例中。我尝试了以下 ELB 配置:

LB Proto、Instance Proto、Postres SSL、成功/失败
TCP,TCP,开启,成功
SSL、TCP、开启、失败
TCP,SSL,开启,失败
SSL,SSL,开启,失败
SSL、TCP、关闭、失败

失败信息如下:

psql: error: could not connect to server: server closed the connection unexpectedly
    This probably means the server terminated abnormally
    before or while processing the request.

也许 NLB 会起作用,也许在 Postgres 服务级别终止 SSL 端到端是 verify-full 成功的唯一方法?

如果它有助于替代方法,postgres 正在 EKS 集群中运行。

感谢您提供的任何信息!

【问题讨论】:

    标签: postgresql amazon-web-services ssl amazon-elb amazon-eks


    【解决方案1】:

    我们在 RDS postgres db 前使用 NLB。不幸的是,它只是“代理”了没有 SSL 终止的请求——NLB 配置在 TCP 端口 5432 上。你看过相对较新的AWS RDS proxy——根据文档,它应该能够进行 SSL 终止,我不确定是否可以在没有 RDS 的情况下使用它。另一种方法当然是自己设置这个代理,这个解决方案的所有优点和缺点。

    【讨论】:

      猜你喜欢
      • 2017-03-24
      • 2019-10-07
      • 2018-12-04
      • 2019-01-23
      • 1970-01-01
      • 2021-02-21
      • 2017-04-06
      • 2017-08-03
      • 1970-01-01
      相关资源
      最近更新 更多