&quot“主机名不匹配”并“无法获得本地发行人证书”当使用dbcrossbar连接到Postgres时

发布于 2025-01-27 21:38:39 字数 1532 浏览 1 评论 0 原文

我想使用DBCROSSBAR软件包连接到Postgres数据库。因此,我将使用以下代码连接到数据库。这很好。但是,当使用DBCROSSBAR时,我似乎有错误连接,我不知道会发生这种情况。

psql -h localhost -d my_db -U postgres 
psql -h <server_ip> -d my_db2 -U postgres

DBCROSSBAR代码如下:

1)
dbcrossbar cp \
    --if-exists=overwrite \
    --schema=postgres-sql:table.sql \
    csv:"my_csv.csv" \
    'postgres://postgres@localhost:5432/my_db#my_table'

2)
dbcrossbar cp \
    --if-exists=overwrite \
    --schema=postgres-sql:table.sql \
    csv:"my_csv.csv" \
    'postgres://postgres@<server_ip>:5432/my_db#my_table'

连接到Localhost的第一条代码GIEDS ME错误(主机名不匹配),连接到服务器的第二件代码给出了错误(无法获得本地发行者证书)。为了解决它,我已经看过,但找不到问题。在这里,我尝试了 openssl s_client -connect&lt;:&lt; port&gt; ,并且对于这两种方法,它都输出验证OK(0),因此一切似乎都在起作用。我认为这必须使用我的设置做点事,因为在DBCrossbar Github上找不到这个问题,在收到此类错误时可能会有什么问题?

完整输出:

1)
Error: could not connect to PostgreSQL
  caused by: error performing TLS handshake: error:0A000086:SSL routines:tls_post_process_server_certificate:certificate verify failed:../ssl/statem/statem_clnt.c:1883: (hostname mismatch)

2)
Error: could not connect to PostgreSQL
  caused by: error performing TLS handshake: error:0A000086:SSL routines:tls_post_process_server_certificate:certificate verify failed:../ssl/statem/statem_clnt.c:1883: (unable to get local issuer certificate)

I want to connect to my postgres databases using the dbcrossbar packages. So I'd connect to my database using the code below. This works perfectly fine. However, when using dbcrossbar I seem to have errors connecting and I have no idea how this can occur.

psql -h localhost -d my_db -U postgres 
psql -h <server_ip> -d my_db2 -U postgres

The dbcrossbar code is as follows:

1)
dbcrossbar cp \
    --if-exists=overwrite \
    --schema=postgres-sql:table.sql \
    csv:"my_csv.csv" \
    'postgres://postgres@localhost:5432/my_db#my_table'

2)
dbcrossbar cp \
    --if-exists=overwrite \
    --schema=postgres-sql:table.sql \
    csv:"my_csv.csv" \
    'postgres://postgres@<server_ip>:5432/my_db#my_table'

The first piece of code connecting to localhost gived me the error (hostname mismatch) and the second piece of code connecting to the server gives the error (unable to get local issuer certificate). To solve it I already looked at SSL Error: unable to get local issuer certificate but could not find the problem. Here I tried openssl s_client -connect <server>:<port> and for both methods it outputs Verify OK (0), so everything seems to be working. I think it has to do something with my setup, as this issue is not found on the dbcrossbar github, what could be the issue when receiving such errors?

complete output:

1)
Error: could not connect to PostgreSQL
  caused by: error performing TLS handshake: error:0A000086:SSL routines:tls_post_process_server_certificate:certificate verify failed:../ssl/statem/statem_clnt.c:1883: (hostname mismatch)

2)
Error: could not connect to PostgreSQL
  caused by: error performing TLS handshake: error:0A000086:SSL routines:tls_post_process_server_certificate:certificate verify failed:../ssl/statem/statem_clnt.c:1883: (unable to get local issuer certificate)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文