是否可以在 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/