NetWorker:如何导入或更换“AUTHC”和“NWUI”的证书颁发机构签名证书 (Linux)
摘要: 这些是将默认 NetWorker 自签名证书替换为“AUTHC”和 NetWorker Web UI (NWUI) 服务的证书颁发机构 (CA) 签名证书的常规步骤。
说明
这些说明介绍了如何将默认 NetWorker 自签名证书替换为 NetWorker 服务器上的 NetWorker 身份验证 (AUTHC) 和 NetWorker Web UI (NWUI) 服务的 CA 签名证书。
文件名没有命名要求,但应引用文件类型的扩展名。显示的命令示例适用于 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)
准备工作:
创建 Java cacerts 文件的备份拷贝。
cp -p /opt/nre/java/latest/lib/security/cacerts /tmp/cacerts_$(date -I).bkp
身份验证服务证书更换步骤:
而 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
提醒:如果您使用的是 NetWorker 19.13(或更高版本),keytool导入时命令可能会返回警告cacerts证书。要使用的警告状态-cacerts而不是-keystore。尽管出现警告,但可以安全地忽略这一点,本文中显示的语法无论如何都会导入证书。替代方案是将”-keystore $java_bin/../lib/security/cacerts“与”-cacerts“在命令中;这将删除警告。
-
-
编辑
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
AUTHC 后验证:
每个“证书指纹”别名的输出与其他密钥库的输出一致:
$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
或者,您可以检查端口 9090 使用的证书的主题和颁发者:
openssl s_client -connect localhost:9090 -showcerts 2>/dev/null </dev/null | grep -E "issuer|subject"
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 19.13(或更高版本),keytool导入时命令可能会返回警告cacerts证书。要使用的警告状态-cacerts而不是-keystore。尽管出现警告,但可以安全地忽略这一点,本文中显示的语法无论如何都会导入证书。替代方案是将”-keystore $java_bin/../lib/security/cacerts“与”-cacerts“在命令中;这将删除警告。
-
使用 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证书,并将我们的服务器证书放在此具有相同名称的路径中。系统会提示您覆盖原始文件(这将保留现有的所有权和权限)cp -p /nsr/nwui/monitoring/app/conf/emcnwuimonitoring.cer /nsr/nwui/monitoring/app/conf/emcnwuimonitoring.cer_orig cp $cert /nsr/nwui/monitoring/app/conf/emcnwuimonitoring.cer mv -p /opt/nwui/conf/emcnwuiauthc.cer /opt/nwui/conf/emcnwuiauthc.cer_orig cp $cert /opt/nwui/conf/emcnwuiauthc.cer cp -p /opt/nwui/conf/emcnwuiserv.cer /opt/nwui/conf/emcnwuiserv.cer_orig cp $cert /opt/nwui/conf/emcnwuiserv.cer
提醒:系统会提示您覆盖原始文件(这将保留现有的所有权和权限) -
nwuiPostgreSQL 证书更换步骤cp -p $nsr/nwui/monitoring/nwuidb/pgdata/server.crt /nsr/nwui/monitoring/nwuidb/pgdata/server.crt_orig cp -p $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
提醒:系统会提示您覆盖原始文件(这将保留现有的所有权和权限) -
启动
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
或者,您可以检查端口 9090 使用的证书的主题和颁发者:
openssl s_client -connect localhost:9095 -showcerts 2>/dev/null </dev/null | grep -E "issuer|subject"
NetWorker Management Console:
此主题在以下文章中介绍:NetWorker:如何导入或更换 NMC 的证书颁发机构签名证书
NetWorker HTTP 严格传输安全性 (HSTS):
其他信息
以下说明可用于恢复到 cacerts 按照本文操作之前创建的文件副本。以下过程还会将 NetWorker 重置为对 AUTHC 和 NWUI 使用默认自签名证书。
- 确认您有备份拷贝。如果使用了 “开始之前 ”命令,则应具有 Java 的过时副本
cacerts服务器的/tmp目录下看到一个新的 res 目录。例如:
[root@nsr ~]# ls -l /tmp | grep cacerts
-rwxr-xr-x. 1 root root 129266 Mar 23 14:44 cacerts_2026-03-23.bkp
- 停止 Networker 服务:
systemctl stop nwui nsr_shutdown
- 验证 NetWorker 服务未在运行:
systemctl status networker systemctl status nwui
- 将 cacerts 文件复制回其原始位置:
rsync 用法”下所述的政策参数。这用于覆盖现有文件,同时确保维护默认所有权和权限。
rsync -a --no-perms --no-owner --no-group /tmp/cacerts_<date>.bkp /opt/nre/java/latest/lib/security/cacerts
- 重新运行
authc_configure.sh脚本并指定创建新密钥库的选项。示例:
[root@nsr ~]# /opt/nsr/authc-server/scripts/authc_configure.sh
Specify the directory where the Java Standard Edition Runtime Environment (JRE) software is installed [/opt/nre/java/latest]:
The installation process will install an Apache Tomcat instance.
For optimum security, EMC NetWorker Authentication Service will
use a non-root user (nsrtomcat) to start the Apache Tomcat instance.
If your system has special user security requirements, ensure that proper
operational permissions are granted to this non-root user (nsrtomcat).
Please refer to NetWorker Installation Guide.
The Apache Tomcat will use "nsr.amer.lan" as the host name.
The Apache Tomcat will use "9090" as the port number.
The NetWorker Authentication Service requires a keystore file to configure encryption and to provide SSL support.
EMC recommends that you specify a keystore password that has a minimum of six characters.
Do you want to use the existing keystore /nsr/authc/conf/authc.keystore [y]? n
The installation process will create a new keystore file.
Specify the keystore password: HIDDEN_PASSWORD
Confirm the password: HIDDEN_PASSWORD
Creating the installation log in /opt/nsr/authc-server/logs/install.log.
Performing initialization. Please wait...
The installation completed successfully.
- 启动 NetWorker 服务器服务:
systemct start networker
- 使用
nwui_configure.sh脚本并指定创建新密钥库的选项。示例:
[root@nsr ~]# mv /nsr/nwui /nsr/nwui_$(date -I).bak
[root@nsr ~]# /opt/nwui/scripts/nwui_configure.sh Specify the directory where the Java Standard Edition Runtime Environment (JRE) software is installed [/opt/nre/java/latest]: Specify the host name of the NetWorker Authentication Service host [nsr.amer.lan]: Specify the host name of the NetWorker Server to be Managed by NWUI [nsr.amer.lan]: Specify the AUTHC port for Networker Server which is managed by NWUI [9090]: The NetWorker Web UI Server requires a keystore file to configure encryption and to provide SSL support. EMC recommends that you specify a password that has a minimum of nine characters, with at least one upper case letter, one lower case letter, one number and one special character. The installation process will create a new keystore file. Specify the keystore password: HIDDEN_PASSWORD Confirm the password: HIDDEN_PASSWORD
nwui_configure.sh 脚本可能会报告它无法访问端口 9090 上的 AUTHC 服务器。假设使用默认端口 (9090),请等待几分钟,或运行 nwui_configure.sh 在端口 9090 显示为正在侦听后: netstat -apno | grep :9090。
- 启动 NWUI 服务:
systemctl start nwui
- 验证服务是否已启动:
systemctl status networker systemctl status nwui
默认情况下,服务器应使用 Networker 部署的默认自签名证书运行。