postgresql - AWS ELB 的 Postgres SSL 终止

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

是否可以在 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 证书和 key ,我可以在负载均衡器上使用 TCP 协议(protocol),并在实例协议(protocol)上使用 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,以免将证书和 key 传递到运行 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 集群中运行。
感谢您提供的任何信息!

最佳答案

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

关于postgresql - AWS ELB 的 Postgres SSL 终止,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64326627/

相关文章:

sql - Postgres 触发器干扰 'on conflict do update set'

sql - 在许多相邻行上使用 WHERE 进行缓慢的 Postgres 查询

sql - PostgreSQL : how to do GROUP BY in this SQL

amazon-web-services - AWS 命令​​行工具需要重新编码以确保安全登录?

session - https 中 SSL session 的生命周期

sql - 如何判断 Postgres 触发器是否/何时执行

python - 使用 python 删除 S3 中对象的所有版本?

amazon-web-services - 关于使用 Dynamodb 降低成本的建议

asp.net - 为 Web 服务配置 SSL

Facebook 个人资料图片显示为 Http : on secure website expected Https: