NetWorker:如何匯入或更換「Authc」和「NWUI」的認證授權單位簽署憑證 (Linux)
Summary: 以下是將預設 NetWorker 自我簽署憑證更換為「authc」和「nwui」服務的認證機構 (CA) 簽署憑證的一般步驟。
Instructions
這些指示說明如何將預設 NetWorker 自我簽署憑證更換為 CA 簽署憑證,用於 authc 和 nwui NetWorker 伺服器上的服務。
檔名沒有命名要求,但應引用檔類型的擴展名。顯示的命令範例適用於 Linux。如需 Windows 說明,請參閱:。
NetWorker:如何匯入或更換「Authc」和「NWUI」的認證授權單位簽署憑證 (Windows)
涉及的認證檔案:
<server>.csr: NetWorker server certificate signing request <server>.key: NetWorker server private key <server>.crt: NetWorker server CA-signed certificate <CA>.crt: CA root certificate <ICA>.crt: CA intermediate certificate (optional if it is available)
涉及的金鑰存放區:
authc.keystore authc.truststore cacerts nwui.keystore
產生私人金鑰和憑證簽署要求 (CSR) 檔案以提供給您的 CA。
-
使用 OpenSSL 命令列公用程式建立 NetWorker 伺服器私密金鑰檔案 (
<server>.key) 和 CSR 檔案 (<server>.csr) 的資料儲存應用程式和系統中執行。# openssl req -new -newkey rsa:4096 -nodes -out /tmp/<server>.csr -keyout /tmp/<server>.key
-
傳送 CSR 檔案 (
<server>.csr) 以產生 CA 簽署的憑證檔 (<server>.crt) 的資料儲存應用程式和系統中執行。CA 應提供 CA 簽署的憑證檔案 (<server>.crt),根憑證 (<CA>.crt),以及任何中間 CA 憑證 (<ICA>.crt) 的資料儲存應用程式和系統中執行。
預先驗證步驟:
請確定您具備下列項目:
- server.crt 檔案,其中包含 PEM 憑證,其第一行為 -----BEGIN CERTIFICATE-----最後一行為 -----END CERTIFICATE-----
- 金鑰檔案以 -----BEGIN RSA PRIVATE KEY-----開頭,-----END RSA PRIVATE KEY」結束-----
- 執行此命令,確認所有憑證均為有效的 PEM 格式檔案
openssl x509 -in <cert> -text -noout。 - 驗證上述輸出,確定其為正確的憑證。
- 檢查下列兩個命令的輸出:
openssl rsa -pubout -in server.key
openssl x509 -pubkey -noout -in server.crt
這兩個命令的輸出必須匹配。
為了便於執行以下所述步驟和命令,我們建立了以下變數:
java_bin=/opt/nre/java/latest/bin nsr=<path to /nsr partition> # In case of NVE for instance this is /data01/nsr cert=<path to server crt file> key=<path to server key file> RCAcert=<path to Root CA file> ICAcert=<path to intermediate CA crt file>
如果有多個中間證書,請為每個證書創建變數:ICA1、ICA2 等
您必須知道正確的 NetWorker 金鑰存放區密碼。這些密碼是在 AUTHC 和 NWUI 組態期間設定。如果您不確定,請參閱:
您還可以使用金鑰庫傳遞變數(選項 1)或將它們儲存在檔中以隱藏密碼(選項 2):
選項 1 的範例:
authc_storepass='P4ssw0rd!' nwui_storepass='Password1!'
選項 2 的範例:
authc_storepass=$(cat authc_storepass_file.txt) nwui_storepass=$(cat nwui_storepass_file.txt)
開始之前:
製作已更新金鑰存放區和組態檔案的備份複本。
tar -zcvf /tmp/NSR_$(hostname -s)_$(date -I).tar.gz $java_bin/../lib/security/cacerts $nsr/nwui/monitoring/app/conf/nwui.keystore /opt/nsr/authc-server/conf /nsr/nwui/monitoring/nwuidb/pgdata
認證服務憑證更換步驟:
可使用 authc 不必停止服務,以下過程即可工作。但是,必須重新啟動它才能載入新證書。
-
匯入憑證
-
匯入根憑證 (
<CA>.crt) 和任何中間 CA 憑證 (<ICA>.crt) 放入authc.keystore。$java_bin/keytool -import -alias RCA -keystore $nsr/authc/conf/authc.keystore -file $RCAcert -storepass $authc_storepass $java_bin/keytool -import -alias RCA -keystore /opt/nsr/authc-server/conf/authc.truststore -file $RCAcert -storepass $authc_storepass $java_bin/keytool -import -alias ICA -keystore $nsr/authc/conf/authc.keystore -file $ICAcert -storepass $authc_storepass $java_bin/keytool -import -alias ICA -keystore /opt/nsr/authc-server/conf/authc.truststore -file $ICAcert -storepass $authc_storepass
-
使用 NetWorker 伺服器私人金鑰檔案 (
<server>.key) 和新的 CA 簽署憑證檔案 (<server>.crt) 以建立 PKCS12 儲存檔案emcauthctomcat和emcauthcsaml別名。openssl pkcs12 -export -in $cert -inkey $key -name emcauthctomcat -out /tmp/$hostname.tomcat.authc.p12 -password pass:$authc_storepass openssl pkcs12 -export -in $cert -inkey $key -name emcauthcsaml -out /tmp/$hostname.saml.authc.p12 -password pass:$authc_storepass
注意:此 pkcs12 檔案密碼必須與金鑰存放區的密碼相符。這就是為什麼在這種情況下,我們使用authc商店通行證。 -
將 PKCS12 儲存檔案匯入
authc.keystore。$java_bin/keytool -importkeystore -destkeystore /nsr/authc/conf/authc.keystore -srckeystore /tmp/$hostname.tomcat.authc.p12 -srcstoretype PKCS12 -srcstorepass $authc_storepass -deststorepass $authc_storepass $java_bin/keytool -importkeystore -destkeystore /nsr/authc/conf/authc.keystore -srckeystore /tmp/$hostname.saml.authc.p12 -srcstoretype PKCS12 -srcstorepass $authc_storepass -deststorepass $authc_storepass
-
將 PKCS12 儲存檔案匯入
authc.truststore。$java_bin/keytool -importkeystore -destkeystore /opt/nsr/authc-server/conf/authc.truststore -srckeystore /tmp/$hostname.tomcat.authc.p12 -srcstoretype PKCS12 -srcstorepass $authc_storepass -deststorepass $authc_storepass $java_bin/keytool -importkeystore -destkeystore /opt/nsr/authc-server/conf/authc.truststore -srckeystore /tmp/$hostname.saml.authc.p12 -srcstoretype PKCS12 -srcstorepass $authc_storepass -deststorepass $authc_storepass
-
刪除預設的 NetWorker 自我簽署憑證,並匯入新的 CA 簽署憑證檔案 (
<server>.crt) 放入authc.truststore.$java_bin/keytool -delete -alias emcauthctomcat -keystore /opt/nsr/authc-server/conf/authc.truststore -storepass $authc_storepass $java_bin/keytool -import -alias emcauthctomcat -keystore /opt/nsr/authc-server/conf/authc.truststore -file $cert -storepass $authc_storepass $java_bin/keytool -delete -alias emcauthcsaml -keystore /opt/nsr/authc-server/conf/authc.truststore -storepass $authc_storepass $java_bin/keytool -import -alias emcauthcsaml -keystore /opt/nsr/authc-server/conf/authc.truststore -file $cert -storepass $authc_storepass
-
最後,請將此憑證匯入 Java cacerts 金鑰存放區檔案,路徑為:
emcauthctomcat別名:$java_bin/keytool -delete -alias emcauthctomcat -keystore $java_bin/../lib/security/cacerts -storepass changeit $java_bin/keytool -import -alias emcauthctomcat -keystore $java_bin/../lib/security/cacerts -file $cert -storepass changeit
-
-
編輯
admin_service_default_url=localhost值在authc-cli-app.properties檔,以反映 CA 簽署憑證檔案中使用的 NetWorker 伺服器名稱:cat /opt/nsr/authc-server/conf/authc-cli-app.properties admin_service_default_protocol=https admin_service_default_url=<my-networker-server.my-domain.com> admin_service_default_port=9090 admin_service_default_user= admin_service_default_password= admin_service_default_tenant= admin_service_default_domain= - 需要重新啟動 NetWorker 服務,才能
authc以使用新導入的證書。
nsr_shutdown systemctl start networker
-
重新建立
authcNetWorker 伺服器上的信任:nsrauthtrust -H <local host or Authentication_service_host> -P 9090
認證後驗證:
每個「憑證指紋」別名的輸出與其他金鑰存放區的輸出一致:
$java_bin/keytool -list -keystore $java_bin/../lib/security/cacerts -storepass changeit | grep emcauthctomcat -A1 $java_bin/keytool -list -keystore /opt/nsr/authc-server/conf/authc.truststore -storepass $authc_storepass | grep emcauthctomcat -A1 $java_bin/keytool -list -keystore $nsr/authc/conf/authc.keystore -storepass $authc_storepass | grep emcauthctomcat -A1
輸出應類似於以下內容:
Certificate fingerprint (SHA-256): FD:54:B4:11:42:87:FF:CA:80:77:D2:C7:06:87:09:72:70:85:C1:70:39:32:A9:C0:14:83:D9:3A:29:AF:44:90
此指紋來自已安裝的憑證。這表示已將新憑證正確導入不同的金鑰存放區中。
openssl x509 -in $cert -fingerprint -sha256 -noout
當 authc 服務已啟動並正在執行中,您可以檢查它提供給入站連接的證書是否與上述證書相同:
openssl x509 -in <(openssl s_client -connect localhost:9090 -prexit 2>/dev/null </dev/null | sed -n -e '/BEGIN\ CERTIFICATE/,/END\ CERTIFICATE/ p') -fingerprint -sha256 -noout
*上述命令是從 NetWorker 伺服器本身執行,因此會連線至本機主機。外部使用的連線 <nw server name>:9090
NetWorker 使用者介面 (nwui) 服務憑證更換步驟:
我們假設 nwui 服務正在 NetWorker 伺服器上執行。
-
停止
nwui服務systemctl stop nwui
-
刪除預設的 NetWorker 自我簽署憑證,並匯入新的 CA 簽署憑證檔案 (
<server>.crt) 複製到 cacerts 金鑰存放區。為了保持一致性,我們全部更換nwui- 與 CA 簽署憑證相關的憑證。- 在執行下列步驟之前,您必須確定使用的是 NetWorker Runtime Environment (NRE) 還是 Java Runtime Environment (JRE)。
- 如果使用 JRE,則 /cacerts 的路徑位於
$java_bin/../lib/security/cacerts。 - 如果使用 NRE,則 /cacerts 的路徑位於
/opt/nre/java/latest/lib/security/cacerts。$java_bin/keytool -delete -alias emcnwuimonitoring -keystore $java_bin/../lib/security/cacerts -storepass changeit $java_bin/keytool -import -alias emcnwuimonitoring -keystore $java_bin/../lib/security/cacerts -file $cert -storepass changeit $java_bin/keytool -delete -alias emcnwuiserv -keystore $java_bin/../lib/security/cacerts -storepass changeit $java_bin/keytool -import -alias emcnwuiserv -keystore $java_bin/../lib/security/cacerts -file $cert -storepass changeit $java_bin/keytool -delete -alias emcnwuiauthc -keystore $java_bin/../lib/security/cacerts -storepass changeit $java_bin/keytool -import -alias emcnwuiauthc -keystore $java_bin/../lib/security/cacerts -file $cert -storepass changeit
-
使用 NetWorker 伺服器私人金鑰檔案 (
<server>.key) 和新的 CA 簽署憑證檔案 (<server>.crt) 以建立 PKCS12 儲存檔案emcauthctomcat和emcauthcsaml的別名nwui金鑰存放區。openssl pkcs12 -export -in $cert -inkey $key -name emcauthctomcat -out /tmp/$hostname.tomcat.nwui.p12 -password pass:$nwui_storepass openssl pkcs12 -export -in $cert -inkey $key -name emcauthcsaml -out /tmp/$hostname.saml.nwui.p12 -password pass:$nwui_storepass
注意:此 pkcs12 檔案密碼必須與金鑰存放區的密碼相符。這就是為什麼在這種情況下,我們使用nwui商店通行證。 -
將 .p12 檔案、根 CA 憑證和中間 CA 憑證匯入
nwui金鑰存放區。$java_bin/keytool -importkeystore -destkeystore $nsr/nwui/monitoring/app/conf/nwui.keystore -srckeystore /tmp/$hostname.tomcat.nwui.p12 -srcstoretype PKCS12 -srcstorepass $nwui_storepass -deststorepass $nwui_storepass $java_bin/keytool -importkeystore -destkeystore $nsr/nwui/monitoring/app/conf/nwui.keystore -srckeystore /tmp/$hostname.saml.nwui.p12 -srcstoretype PKCS12 -srcstorepass $nwui_storepass -deststorepass $nwui_storepass $java_bin/keytool -import -alias RCA -keystore $nsr/nwui/monitoring/app/conf/nwui.keystore -file $RCAcert -storepass $nwui_storepass $java_bin/keytool -import -alias ICA -keystore $nsr/nwui/monitoring/app/conf/nwui.keystore -file $ICAcert -storepass $nwui_storepass
-
重新命名
emcnwuimonitoring小emcnwuiauthc和emcnwuiserv憑證,並將我們的伺服器憑證放在此路徑中,名稱相同。mv /nsr/nwui/monitoring/app/conf/emcnwuimonitoring.cer /nsr/nwui/monitoring/app/conf/emcnwuimonitoring.cer_orig cp $cert /nsr/nwui/monitoring/app/conf/emcnwuimonitoring.cer chown nsrnwui:nsrnwui /nsr/nwui/monitoring/app/conf/emcnwuimonitoring.cer mv /opt/nwui/conf/emcnwuiauthc.cer /opt/nwui/conf/emcnwuiauthc.cer_orig cp $cert /opt/nwui/conf/emcnwuiauthc.cer chown nsrnwui:nsrnwui /opt/nwui/conf/emcnwuiauthc.cer mv /opt/nwui/conf/emcnwuiserv.cer /opt/nwui/conf/emcnwuiserv.cer_orig cp $cert /opt/nwui/conf/emcnwuiserv.cer chown nsrnwui:nsrnwui /opt/nwui/conf/emcnwuiserv.cer
-
啟動
nwui服務systemctl start nwui
nwui 驗證後:
每個「憑證指紋」別名的輸出與其他金鑰存放區的輸出一致:
$java_bin/keytool -list -keystore $nsr/nwui/monitoring/app/conf/nwui.keystore -storepass $nwui_storepass | grep emcauthctomcat -A1 $java_bin/keytool -list -keystore $java_bin/../lib/security/cacerts -storepass changeit | grep emcauthctomcat -A1 $java_bin/keytool -list -storepass $authc_storepass -keystore $nsr/authc/conf/authc.keystore | grep emcauthctomcat -A1
此指紋來自已安裝的憑證。這表示已將新憑證正確導入不同的金鑰存放區中。
openssl x509 -in $cert -fingerprint -sha256 -noout
nwui PostgreSQL 憑證更換步驟
mv $nsr/nwui/monitoring/nwuidb/pgdata/server.crt /nsr/nwui/monitoring/nwuidb/pgdata/server.crt_orig mv $nsr/nwui/monitoring/nwuidb/pgdata/server.key /nsr/nwui/monitoring/nwuidb/pgdata/server.key_orig cp $cert $nsr/nwui/monitoring/nwuidb/pgdata/server.crt cp $key $nsr/nwui/monitoring/nwuidb/pgdata/server.key
<server>.crt 和 <server>.key files 必須是執行 PostgreSQL 資料庫的使用者。
- Linux:nsrnwui
Additional Information
如需有關匯入 CA 簽署憑證的進一步資訊,請參閱 Dell NetWorker 安全性組態指南。
以下知識文章詳述將 NetWorker Management Console (NMC) 自我簽署憑證更換為 CA 簽署憑證的程序: