---
schema_version: "1"
id: 19e8459747cd0f87c2f2819c59a4fc7e901066fb030bd7885b40bab8d07cb5a5
title: 配置 Postgres SSL 以允许从客户端直接连接
collection: tableau
version: current
locale: zh-cn
portal_url: https://docs.salesforce.com/tableau/current/zh-cn/server/ssl_config_direct_cx.md
canonical_url: https://help.tableau.com/current/server/zh-cn/ssl_config_direct_cx.htm
source_site: help.tableau.com
content_type: documentation
content_hash: 665a26a84457e3534f0378426a07bf39d426af999e8f89338994c6b0e6a4ac63
description: Configure Postgres SSL to allow direct client connections to the repository.
---
[跳转到主要内容](#main-content)

# 配置 Postgres SSL 以允许从客户端直接连接

将 Tableau Server 配置为使用 SSL 与 Postgres 存储库进行内部通信时，您还可以要求直接连接到存储库的 Tableau 客户端和外部 Postgres 客户端通过将内部 Postgres 实例提供的 SSL 证书与分发给 Tableau 或外部 Postgres 客户端的证书进行比较来验证 Tableau Postgres 存储库的身份。

直接连接包括使用 **tableau** 用户或 **readonly** 用户的直接连接。Tableau 客户端的示例包括 Tableau Desktop、Tableau Mobile、REST API、Web 浏览器。

1. 通过运行以下命令，为存储库启用内部 SSL：
    
    `tsm security repository-ssl enable`
    
    `tsm pending-changes apply`
    
    这将启用内部 SSL 支持，生成新服务器证书和密钥文件，并要求所有 Tableau 客户端使用 SSL 连接到存储库。有关其他 repository-ssl 命令和选项，请参见[tsm security](https://help.tableau.com/current/server/zh-cn/cli_security_tsm.htm)。
    
    如果待定更改需要重新启动服务器，`pending-changes apply` 命令将显示一个提示，告知您将进行重新启动。即使服务器已停止，此提示也会显示，但在这种情况下不会重新启动。您可以使用 `--ignore-prompt` 选项隐藏提示，但这样做不会改变重新启动行为。如果更改不需要重新启动，则会在不提示的情况下应用更改。有关详细信息，请参见[tsm pending-changes apply](https://help.tableau.com/current/server/zh-cn/cli_pending-changes.htm#pending-changes-apply)。
2. （可选）如果已将客户端计算机配置为验证 Postgres SSL 连接，则必须将 Tableau Server 生成的证书导入运行 Tableau Desktop 的计算机。对于将直接连接到存储库的每台客户端计算机，执行以下操作：
    
    - 将 **server.crt** 文件复制到客户端计算机。您可以在以下目录中找到此文件：
        
        `C:/ProgramData/Tableau/Tableau Server/data/tabsvc/config/pgsql_0.<version_code>/security`
        
        **注意**：不要将 **server.key** 复制到客户端计算机。此文件应位于服务器上。
    - 将证书导入计算机的证书存储。
        
        有关信息，请使用操作系统制造商提供的文档。
3. （可选）配置任何外部（非 Tableau）postgres 客户端（例如 PgAdmin 或 Dbeaver），以验证 Tableau Server postgres 存储库的身份。在客户端用来连接的 PostgreSQL JDBC 驱动程序中执行此操作，方法是将“sslmode”指令设置为“verify-ca”或“verify-full”。可用的选项可能会有所不同，具体取决于正在使用的 postgres 驱动程序的版本。有关详细信息，请参见有关 SSL 支持的驱动程序文档。