【问题标题】:Tableau Desktop connection to PostgreSQL DB using Certificate Authentication over SSL/TLSTableau Desktop 使用基于 SSL/TLS 的证书身份验证连接到 PostgreSQL DB
【发布时间】:2020-01-03 14:34:26
【问题描述】:

我使用证书身份验证(而不是密码)连接到我的 PostgreSQL 数据库(在 AWS EC2 实例上运行)。我用来连接我的一个数据库的 psql 命令示例如下:

psql "host=<AWS EC2 instance> user=<db user> sslcert=<path to .crt> sslkey=<path to .key> sslrootcert=<path to .crt> sslmode=require dbname=<db name>"

我希望能够将 Tableau Desktop 连接到我的一个数据库。标准 PostgreSQL 连接器不允许我指定要使用的 SSL 证书(但它确实有一个 Require SSL 复选框 - 我认为这是用于加密而不是身份验证)。

所以我尝试使用 ODBC 连接器。我做了以下条目:

Connect Using
Driver: PostgreSQL Unicode

Connection Attributes
Server: <AWS EC2 instance>
Port: 5432
Database: <db name>
Username: <db user>
String Extras: sslcert=<path to .crt>; sslkey=<path to .key>; sslrootcert=<path to .crt>; sslmode=require

经过反复试验,我认为 String Extras 需要分号作为分隔符,但我仍然无法连接。我收到错误消息:

An error occurred while communicating with Other Databases (ODBC).

Unable to connect to the server. Check that the server is running and that you have access privileges to the requested database.
FATAL:  connection requires a valid client certificate

Generic ODBC requires additional configuration. The driver and DSN (data source name) must be installed and configured to match the connection.
Unable to connect to the server "<AWS EC2 instance>" using the driver "PostgreSQL Unicode". Check that the server is running and that you have access privileges to the requested database.

如果有人使用证书身份验证将 Tableau Desktop 连接到 PostgreSQL,并能告诉我我做错了什么,我将非常感激。干杯!

【问题讨论】:

    标签: postgresql odbc tableau-api


    【解决方案1】:

    我自己设法解决了这个问题,以防万一有人可能有点兴趣,我会介绍一下突出的功能:

    1.创建了一个 DSN(数据存储名称)

    • 这使得测试变得更加容易,而不是不断地在对话框中重新输入详细信息。
    • 我使用这个而不是手动创建:http://www.odbcmanager.net/
    • 在 Mac OS 上,我必须从终端以 sudo 的身份运行它,否则它不会创建任何东西。
    • 我创建了一个用户 DSN,它在我的 Mac 上的详细信息存储在 /Users/&lt;user name&gt;/.odbc.ini
    • 它选择了我之前安装的 PostgreSQL Unicode 驱动程序。在 Mac OS 上,您可能需要执行 brew install brew install psqlodbc 和/或 brew install unixodbc
    • 大部分配置是通过添加键/值对来指定的,例如DBNAME &lt;db name&gt;
    • 设置 SSLMODE verify-ca(从 require 更改为特定行为 - 如果提供 SSL 证书,psql 假定 verify-ca/verify-full)
    • 证书路径使用键Pqopt 设置,值sslcert=&lt;path to .crt&gt; sslkey=&lt;path to .key&gt; sslrootcert=&lt;path to .crt&gt;。必须小写,并且条目之间只能有空格!

    这是它添加到我用户的 odbc.ini 文件中的内容:

    [<DSN name>]
    Driver      = <path to driver, this was mine /usr/local/lib/psqlodbcw.so>
    Description = <description>
    SSLMODE     = verify-ca
    HOST        = <host>
    DBNAME      = <database>
    PORT        = 5432
    UID         = <db user>
    Pqopt       = sslcert=<path to .crt> sslkey=<path to .key> sslrootcert=<path to .crt>
    

    2。 Tableau 桌面连接

    • 选择其他数据库 (ODBC) 连接器。
    • 选择您之前创建的 DSN(应该会自动获取),它会自动填充主机、端口、数据库和用户字段,然后点击登录。
    • 登录后的行为与专用 PostgreSQL 连接器略有不同。表格最初没有出现在左侧。但它们是可访问的——它们都可以通过单击“包含”单选按钮并使用空白名称进行搜索来显示。

    希望这会有所帮助。如果您有任何问题,请告诉我。

    【讨论】:

    • 小提示,要添加密码,请使用上面的“PWD”键。
    猜你喜欢
    • 2022-08-23
    • 2017-01-02
    • 2014-12-22
    • 1970-01-01
    • 1970-01-01
    • 2016-10-02
    • 1970-01-01
    • 2013-08-04
    • 2019-05-14
    相关资源
    最近更新 更多