瞭解 keytab 需求

Kerberos 驗證依賴於存放在特殊格式檔案(稱為 Keytab 檔案)中的認證。您可能需要為 Tableau Server 部署產生 Keytab 檔案。本主題介紹 Tableau Server 用於存取一個典型組織中的各種服務的 Keytab 檔案。您可能需要為 Tableau Server 產生 Keytab,才能整合至下列服務:

  • Windows Active Directory 中的使用者驗證 (SSO)
  • 資料來源委派
  • 作業系統
  • 目錄服務

重要資訊: 從 Tableau Server 2021.2.25、2021.3.24、2021.4.19、2022.1.15、2022.3.7 和 2023.1.3(或更高版本)開始,請確保使用 AES-128 或 AES-256 密碼建立 keytab 檔案。不再支援 RC4 和 3DES 密碼。有關詳細資料,請參閱 Tableau 知識庫中的「Tableau Server 無法自動對您進行驗證」(連結在新視窗開啟)

如果組織中有負責處理身分、驗證和/或安全性的 IT 專家,則您應與他們協作,建立一個用於為 Tableau Server 部署產生適當 Keytab 的規劃。

Windows Active Directory 中的使用者驗證 (SSO)

如果將使用 Active Directory 作為 Tableau Server 的識別身分存放區,並且希望向使用 Kerberos SSO 進行驗證,則您將需要為 Tableau Server 產生 Keytab 檔案。

Tableau 執行平台...需要手動產生 Keytab ?
Active Directory 網域中的 Windows
Active Directory 網域中的 Linux
非 Active Directory 環境中的 Windows 或 LinuxKerberos SSO 不屬於受支援的使用案例。

請遵循以下建議(適用於 Windows 版和 Linux 版 Tableau Server):

  • 在您的目錄中為 Tableau Server 建立一個服務帳戶。

  • 專門為 Tableau Server 服務帳戶建立一個 Keytab 。不要重用電腦帳戶/作業系統用於進行驗證的 Keytab 檔案。您可以將在上面方案中用於目錄驗證的相同 Keytab 用於 Kerberos SSO。

  • 您必須在 Active Directory 中為 Tableau Server 服務建立服務主要名稱。

  • 在下一部分中使用批次檔案來建立 SPN 和 Keytab 檔案。

  • 建立了 SPN 之後,請按設定 Kerberos中所述的方式上載 Keytab 檔案。

批次檔案:在 Active Directory 中設定 SPN 並建立 Keytab

您可以使用批次檔案來設定服務主要名稱 (SPN) 並建立 Keytab 檔案。在為 Active Directory 中執行的 Tableau Server(在 Windows 或 Linux)啟用 Kerberos SSO 的過程中,將執行這些操作。

在以前版本的 Tableau Server(2018.2 之前)中,設定指令碼是透過 Tableau Server 設定公用程式產生的。

若要產生設定指令碼,請將以下批次檔案內容複製並粘貼到一個文字檔中。該批次檔案為 Tableau Server 建立服務主要名稱 (SPN),並為您在檔案中指定的使用者建立 Keytab 檔案。

執行檔案內容中的指令。完成檔案的自訂之後,將其另存新檔案為 .bat 檔案。

此檔案必須由域管理員在 Active Directory 域中執行,系統將提示該管理員輸入您在檔案中指定的帳戶的服務帳戶密碼。

批次檔使用 Windows set(連結在新視窗開啟)setspn(連結在新視窗開啟)ktpass(連結在新視窗開啟) 命令。

附註:下方批次檔為自行記錄。不過,如果您沒有使用 Kerberos 或產生 Keytab 檔案的經驗,繼續操作之前,建議您先閱讀 Microsoft 部落格文章 All you need to know files(連結在新視窗開啟)(檔案須知事項)。組織中的環境詳細資料可能需要使用額外的 ktpass 指令設定。例如,您必須決定要為 /crypto 參數設定的項目。建議您指定 KDC 要求的單一 /crypto 值。請參閱 Microsoft 文章 ktpass(連結在新視窗開啟),以取得 /crypto 參數的支援值完整清單。

SPN 和 Keytab 批次檔案內容

從 Tableau Server 2022.3、2022.1.8、2021.4.12、2021.3.17、2021.2.18、2021.1.20 與 2020.4.23 開始

@echo off
setlocal EnableDelayedExpansion

REM ******* 

REM This script generates the Service Principal Names (SPNs) and keytab files required for 
REM Kerberos SSO with Apache.
REM This script executes set, setspn, and ktpass commands included in any Windows Server 
REM Operating System from 2003 on.
REM Before running this script you must enter configuration information for the setspn and 
REM ktpass commands. 
REM Elements that require your configuration information are enclosed in as such:
REM  ! -- and --!. 
REM After you customize this file, save it as a .bat file, and run on a domain-joined 
REM computer. 
REM This script must be run by a Domain admin.

REM **********

REM The following set command will prompt the domain admin for credentials of the 
REM Tableau Server service account. 
REM This account must be a valid domain user account.
REM If the password contains a literal \" (blackslash - double quote), all backslashes 
REM immediately before the double quote must be
REM duplicated when typed for the password to work, e.g. if password contains 
REM  \" replace with \\", if passwords contains \\" replace with \\\\"

set /p adpass= "Enter password for the Tableau Server service account."
set adpass=!adpass:"=\"!

REM **********

REM The following setspn commands create the SPN in the domain.
REM More information on setspn can be found here: 
REM http://technet.microsoft.com/en-us/library/cc731241(WS.10).aspx  
REM Enter the canonical FQDN and the host names for Tableau Server followed by the  
REM Tableau Server service account name.
REM Use this syntax: HTTP/hostname domain\service_account_name.
REM The example below shows syntax for a computer named "tableau01" in the "example.lan"  
REM domain, with service account, "tab-serv-account":
REM setspn -s HTTP/tableau01 example\tab-serv-account
REM setspn -s HTTP/tableau01.example.lan example\tab-serv-account  
REM DNS and AD are not case sensitive, but the keytab files are.  Verify that host names  
REM match letter case as stored in DNS. 
REM Use Windows Server's DNS Manager utility to verify host name case.

REM **********

echo Creating SPNs...
setspn -s HTTP/!--replace with canonical host name and service account --!
setspn -s HTTP/!--replace with canonical FQDN and service account --!

REM **********

REM The following commands create the keytab file in the same directory where the 
REM bat file is run. More information on ktpass can be found here: 
REM https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/ktpass 
REM Note: keytab files are case-sensitive.
REM The realm following the FQDN should be all uppercase.
REM Syntax is:
REM ktpass /princ HTTP/!--FQDN--!@!--Kerberos_Realm--! /pass !adpass!
REM /pttype KRB5_NTPRINCIPAL /crypto !--cipher--! /out keytabs\kerberos.keytab
REM Best practice: specify the /crypto value that is required by your KDC. 
REM Options for /crypto = {DES-CBC-CRC|DES-CBC-MD5|AES256-SHA1|AES128-SHA1|All}
REM Do not specify /crypto All because it will result in a keytab that contains ciphers that are not supported
REM and cause errors.
REM When using AES256-SHA1 OR AES128-SHA1, the /mapuser option must be included 
REM in the ktpass command to ensure the keytab file is mapped properly to the user. For example:
REM ktpass /princ HTTP/!--FQDN--!@!--Kerberos_Realm--! /pass !adpass! /ptype KRB5_NT_PRINCIPAL /mapuser <domain\username> /crypto AES256-SHA1 /out keytabs\kerberos.keytab
REM The following example shows the ktpass syntax with the example.lan configuration from above:
REM ktpass /princ HTTP/!--FQDN--!@!--Kerberos_Realm--! /pass !adpass! /ptype KRB5_NT_PRINCIPAL /crypto DES-CBC-CRC /out keytabs\kerberos.keytab
					
REM **********

echo Creating Keytab files in %CD%\keytabs
mkdir keytabs
ktpass /princ HTTP/!--FQDN--!@!--Kerberos_Realm--! /pass !adpass! /ptype KRB5_NT_PRINCIPAL /crypto DES-CBC-CRC /out keytabs\kerberos.keytab

Tableau Server 的較早版本

@echo off
setlocal EnableDelayedExpansion

REM ******* 

REM This script generates the Service Principal Names (SPNs) and keytab files required for 
REM Kerberos SSO with Apache.
REM This script executes set, setspn, and ktpass commands included in any Windows Server 
REM Operating System from 2003 on.
REM Before running this script you must enter configuration information for the setspn and 
REM ktpass commands. 
REM Elements that require your configuration information are enclosed in as such:
REM  ! -- and --!. 
REM After you customize this file, save it as a .bat file, and run on a domain-joined 
REM computer. 
REM This script must be run by a Domain admin.

REM **********

REM The following set command will prompt the domain admin for credentials of the 
REM Tableau Server service account. 
REM This account must be a valid domain user account.
REM If the password contains a literal \" (blackslash - double quote), all backslashes 
REM immediately before the double quote must be
REM duplicated when typed for the password to work, e.g. if password contains 
REM  \" replace with \\", if passwords contains \\" replace with \\\\"

set /p adpass= "Enter password for the Tableau Server service account."
set adpass=!adpass:"=\"!

REM **********

REM The following setspn commands create the SPN in the domain.
REM More information on setspn can be found here: 
REM http://technet.microsoft.com/en-us/library/cc731241(WS.10).aspx  
REM Enter the canonical FQDN and the host names for Tableau Server followed by the  
REM Tableau Server service account name.
REM Use this syntax: HTTP/hostname domain\service_account_name.
REM The example below shows syntax for a computer named "tableau01" in the "example.lan"  
REM domain, with service account, "tab-serv-account":
REM setspn -s HTTP/tableau01 example\tab-serv-account
REM setspn -s HTTP/tableau01.example.lan example\tab-serv-account  
REM DNS and AD are not case sensitive, but the keytab files are.  Verify that host names  
REM match letter case as stored in DNS. 
REM Use Windows Server's DNS Manager utility to verify host name case.

REM **********

echo Creating SPNs...
setspn -s HTTP/!--replace with canonical host name and service account --!
setspn -s HTTP/!--replace with canonical FQDN and service account --!

REM **********

REM The following commands create the keytab file in the same directory where the 
REM bat file is run. More information on ktpass can be found here: 
REM https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/ktpass 
REM Note: keytab files are case-sensitive.
REM The realm following the FQDN should be all uppercase.
REM Syntax is:
REM ktpass /princ HTTP/!--FQDN--!@!--Kerberos_Realm--! /pass !adpass!
REM /pttype KRB5_NTPRINCIPAL /crypto !--cipher--! /out keytabs\kerberos.keytab
REM Best practice: specify the /crypto value that is required by your KDC. 
REM Options for /crypto = {DES-CBC-CRC|DES-CBC-MD5|RC4-HMAC-NT|AES256-SHA1|AES128-SHA1|All}
REM Specifying /crypto All will result in passwords stored with RC4 cipher, which is
REM no longer considered secure.
REM When using AES256-SHA1 OR AES128-SHA1, the /mapuser option must be included 
REM in the ktpass command to ensure the keytab file is mapped properly to the user. For example:
REM ktpass /princ HTTP/!--FQDN--!@!--Kerberos_Realm--! /pass !adpass! /ptype KRB5_NT_PRINCIPAL /mapuser <domain\username> /crypto AES256-SHA1 /out keytabs\kerberos.keytab
REM The following example shows the ktpass syntax with the example.lan configuration from above:
REM ktpass /princ HTTP/!--FQDN--!@!--Kerberos_Realm--! /pass !adpass! /ptype KRB5_NT_PRINCIPAL /crypto DES-CBC-CRC /out keytabs\kerberos.keytab
					
REM **********

echo Creating Keytab files in %CD%\keytabs
mkdir keytabs
ktpass /princ HTTP/!--FQDN--!@!--Kerberos_Realm--! /pass !adpass! /ptype KRB5_NT_PRINCIPAL /crypto DES-CBC-CRC /out keytabs\kerberos.keytab

作業系統

如果組織使用 Kerberos 進行驗證,則執行 Tableau Server 的電腦必須向它在其中執行的 Kerberos 域進行驗證。

Tableau 執行平台...需要手動產生 Keytab ?
Active Directory 網域中的 Windows
Active Directory 網域中的 Linux
非 Active Directory 環境中的 Windows 或 Linux

如果執行 Windows 版 Tableau Server,並且電腦已加入 Active Directory,則您無需為作業系統管理或產生 Keytab 檔案。

如果在 Kerberos 域(MIT KDC 或 Active Directory)中執行 Linux 版 Tableau Server,則您需要專門為電腦作業系統產生 Keytab 檔案。您為電腦建立的 Keytab 應專用於作業系統驗證。不要為您將用於本主題後面描述的其他服務的作業系統驗證使用同一 Keytab 檔案。

目錄服務

如果組織使用目錄服務(例如 LDAP 或 Active Directory)來管理使用者身分,則 Tableau Server 將需要該目錄的唯讀存取權限。

或者,您可以透過安裝本機識別身分存放區將 Tableau Server 設定為管理所有帳戶。在此情況下,您不需要使用 Keytab。

下表匯總了 keytab 需求:

Tableau 執行平台...目錄服務需要手動產生 Keytab ?
AD 域中的 WindowsActive Directory
WindowsLDAP(GSSAPI 繫結)
LinuxActive Directory 或 LDAP(GSSAPI 繫結)
Windows 或 LinuxActive Directory 或 LDAP(簡單繫結)
Windows 或 Linux本機身分識別存放區不需要 Keytab。

如果需要為此方案手動產生 Keytab ,則您將需要使用它透過 GSSAPI 繫結到目錄。請遵循以下建議:

  • 在您的目錄中為 Tableau Server 建立一個服務帳戶。

  • 專門為 Tableau Server 服務帳戶建立一個 Keytab 。不要重用電腦帳戶/作業系統用於進行驗證的 Keytab 檔案。

  • 上載 Keytab 檔案作為 Tableau Server 識別身分存放區 json 設定的一部分。請參閱identityStore 實體

作為災難復原計劃的一部分,我們建議將 keytab 和 conf 檔案的備份儲存在 Tableau Server 之外的安全位置。新增至 Tableau Server 的 keytab 和 conf 檔案將由用戶端檔案服務儲存並散發至其他節點。但是,這些檔案不會以可復原的格式儲存。請參閱Tableau Server Client File Service

資料來源委派

您也可以使用 Kerberos 委派在 Active Directory 中存取資料來源。在此方案中,可以使用支援的驗證機制(SAML、本機驗證、Kerberos 等)向 Tableau Server 驗證使用者的身分,但使用者可存取 Kerberos 啟用的資料來源。

請遵循以下建議:

  • Tableau Server(Windows 或 Linux)的電腦帳戶必須位於 Active Directory 網域。

  • 用於 Kerberos 委派的 Keytab 檔案可與用於 Kerberos 使用者驗證 (SSO) 的 Keytab 檔案相同。

  • Keytab 必須對應到 Active Directory 中的 Kerberos 委派服務主體。

  • 您可以為多個資料來源使用相同 Keytab 。

有關詳情,請參閱以下設定主題:

感謝您的意見反應!已成功提交您的意見回饋。謝謝!