NetWorker:如何导入或更换“Authc”和“NWUI”的证书颁发机构签名证书 (Linux)
Summary: 这些是将“authc”和“nwui”服务的默认 NetWorker 自签名证书替换为证书颁发机构 (CA) 签名证书的常规步骤。
Instructions
这些说明介绍了如何将默认 NetWorker 自签名证书替换为 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 以生成 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 文件密码必须与密钥库的密码匹配。这就是为什么在这种情况下,我们使用authcStorePass。 -
将 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 文件密码必须与密钥库的密码匹配。这就是为什么在这种情况下,我们使用nwuiStorePass。 -
将 .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 签名证书的过程: