psql:根证书文件“系统”不存在。为什么 `sslrootcert=system` 不起作用?

问题描述 投票:0回答:1

我有两个主持人。在两台主机上,我下载并安装 AWS RDS 证书包。然后我尝试连接 PostgreSQL 数据库:

psql "postgresql://[email protected]/user?sslmode=verify-full&sslrootcert=system"

我看到

sslrootcert
选项有效并记录在案:https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-CONNECT-SSLROOTCERT

使用 sslrootcert=system 时,默认 sslmode 更改为 verify-full,任何较弱的设置都会导致错误。

在一台主机上,该命令工作正常,但在另一台主机上,它返回下一个错误:

psql: error: connection to server at "example.com" (x.y.z.a), port 5432 failed: root certificate file "system" does not exist
Either provide the file or change sslmode to disable server certificate verification.

我看到的唯一不同的是

psql
版本。

psql (PostgreSQL) 15.5 (Debian 15.5-1.pgdg120+1)      # The version which works fine
psql (PostgreSQL) 15.5 (Ubuntu 15.5-0ubuntu0.23.10.1) # The version with the error

为什么

sslrootcert=system
不起作用?

ssl-certificate psql
1个回答
0
投票

您提供的链接包含版本 16 的文档。如果您查看 版本 15,则没有选项可以将 sslrootcert 参数设置为

system
作为对系统根证书的引用,而只能作为文件路径。这就是为什么您的一台服务器抱怨系统文件丢失。

我的假设是这是一个未记录的功能。在某些时候,开发人员启用了指定

system
值的功能,但并未宣布。并在版本 16 发布时宣布。您可以通过搜索短语 sslrootcert=system
changelog
中找到它。

为了确保此参数有效,我认为您应该将客户端更新到版本 16。

© www.soinside.com 2019 - 2024. All rights reserved.