藉由匯出和匯入 DAS 憑證,可將 DAS 變成 Web 伺服器的受信任用戶端。使用 DAS 憑證的用戶端認證可確保唯有連線到 Web 伺服器的 DAS 可做為受信任的用戶端。
開啟終端機視窗,並使用下列指令設定 LD_LIBRARY_PATH:
export LD_LIBRARY_PATH=/opt/SUNWappserver/lib
若是使用 Application Server 9.1,請執行下列指令來匯出 DAS 憑證。DAS 憑證可同時做為伺服器憑證以及用戶端憑證。
<appserver_install_dir>/lib/upgrade/pk12util -d <domain root>/config -o s1as.p12 -W <s1as.pk12-file-password> -K <master password> -n s1as
若是使用 GlassFish v2,請匯出 DAS 憑證,並使用 Java SE 5.0 安全性工具 (名為 keytool),為該憑證提供別名「s1as」。執行此動作時,請選取 -rfc 選項來匯出可列印編碼格式 (由 Internet RFC 1421 標準定義) 的憑證。
在指令行中,可使用下列指令匯出 DAS 憑證:
<JAVA_HOME>/bin/keytool -export -rfc -alias s1as -keystore <GLASSFISH_HOME>/domains/<DOMAIN_NAME>/config/keystore.jks-file s1as.rfc
其中,<GLASSFISH_HOME> 表示 Application Server 安裝目錄,<DOMAIN_NAME> 則表示正在匯出憑證的網域。
將憑證檔複製到 Web 伺服器配置目錄。
若是使用 Application Server 9.1,請使用下列指令,將 DAS 憑證匯入 Web 伺服器實例並設定憑證的信任屬性:
<webserver_install_dir>/bin/pk12util -i <path_to_s1as.pk12-file> -d <webserver_install_dir>/admin-server/config-store/<default-config-name>/config -K <webserver security db password> -W <s1as.pk12-file-passwd>
<webserver_install_dir>/bin/certutil -M -n s1as -t "TCu" -d <webserver_install_dir>/admin-server/config-store/<default-config-name>/config
這些指令可使 Application Server CA 成為信任的 CA,以便簽署用戶端和伺服器憑證二者。
若是使用 GlassFish v2,請從使用 certutil (NSS 安全性工具) 所建立的 rfc 檔匯入 DAS 憑證。
<webserver_install_dir>/bin/certutil -A -a -n s1as -t "TCu" -i s1as.rfc -d <webserver_install_dir>/admin-server/config-store/<CONFIG_NAME>/config
其中,<webserver_install_dir> 表示 Web 伺服器安裝目錄,<CONFIG_NAME> 則表示為預設 Web 伺服器實例所建立的配置名稱。
您可以使用下列指令來檢查是否存在此憑證,它會列出 s1as 憑證與其他 CA 憑證,包括預設的伺服器憑證。請務必將此指令在單獨一行中完整鍵入。
<webserver_install_dir>/bin/certutil -L -d <webserver_install_dir>/admin-server/config-store/ <DEFAULT_CONFIG_NAME>/config
您也可以使用 Web 伺服器管理主控台來檢視此憑證。選取已匯入憑證的配置 (在此情況下為預設配置),然後選取 [憑證] 標籤。若要查看所有可用的憑證,請選取 [憑證授權單位] 子標籤。
若是使用 GlassFish v2,請為 Web Server 7 執行下列配置變更。若是使用 Application Server 9.1,則可跳至下一個步驟。
將下列幾行附加到 <WS_INSTALL_ROOT>/admin-server/config-store/<DEFAULT_CONFIG_NAME>/config/ 的 obj.conf 檔案。確定鍵入這些指令行時沒有尾隨空格。
<Object ppath="*lbconfigupdate*"> PathCheck fn="get-client-cert" dorequest="1" require="1" </Object> <Object ppath="*lbgetmonitordata*"> PathCheck fn="get-client-cert" dorequest="1" require="1" </Object>
部署配置。執行在前幾個步驟中所列出的變更時,管理主控台會將此配置標記為已部署。
從 GlassFish DAS 測試此設定,查看其是否可透過 SSL 與已配置的 HTTP 負載平衡器進行通訊。如需更多資訊,請參閱確認設定。