华为OceanStor 5500 V3存储证书过期问题处理

一、故障现象

客户的华为OceanStor 5500V3的3个证书即使过过期,出现以下告警:

告警有提示相关的处理建议:

如果客户有密管服务器,那么从存储中将证书请求导出来后,使用密管服务器对证书请求进行签名,然后将证书导入存储,问题即可解决。

二、处理步骤

由于客户没有配置密管服务器,而且存储的型号比较旧,新型号的存储(OceanStor 6.1.5版本以上)可以使用参考2链接中的方法利用存储内置的CA中心来签发证书,因此需要使用自签名的方法来签发证书。

以下步骤是使用自签名的方法来签发证书:

1.通过以下三种方法之中的一种获取存储的ESN号即序列号:

  1. 在证书管理界面中导出相应的证书请求。

3.参考"参考1"链接中的方法搭建CA中心。

1)OpenSSL环境准备。

准备一台已经安装OpenSSL工具的Linux设备(一般Ubuntu、CentOS系统都有预装),并使用openssl version命令确认环境中OpenSSL的版本为"1.0.2a"及以上。

openssl version

OpenSSL 1.0.2p-fips 14 Aug 2018

2)创建临时目录,例如:/tmp/cert,并进入该目录进行后续操作。

mkdir -p /tmp/cert

cd /tmp/cert

3)创建并编辑ssl.conf文件。

vi ssl.conf

复制以下内容到上述的ssl.conf文件中。

bash 复制代码
[ req ]
default_bits = 4096
distinguished_name = req_distinguished_name
 
[ req_distinguished_name ]
countryName = Country Name (2 letter code)
countryName_default = CN
stateOrProvinceName = State or Province Name (full name)
stateOrProvinceName_default = SC
localityName = Locality Name (eg, city)
localityName_default = CD
organizationName = Organization Name (eg, company)
organizationName_default = Huawei
organizationalUnitName = Organizational Unit Name (eg, section)
organizationalUnitName_default = Storage
commonName = Common Name (e.g. server FQDN or YOUR name)
commonName_max = 64
commonName_default = xxxx
 
[ x509_ext ]
subjectKeyIdentifier        = hash
authorityKeyIdentifier    = keyid,issuer
 
[ v3_ca ]
subjectKeyIdentifier=hash
authorityKeyIdentifier=keyid:always,issuer
basicConstraints = CA:true

其中,上述内容里的"xxxx"需要修改为存储阵列的ESN号。

4)使用OpenSSL工具生成CA私钥和CA证书。

a.建立证书文件相关的目录和文件。

mkdir -p /etc/pki/CA

touch /etc/pki/CA/index.txt

touch /etc/pki/CA/serial

echo 00 > /etc/pki/CA/serial

mkdir -p /tmp/cert/demoCA

touch /tmp/cert/demoCA/index.txt

touch /tmp/cert/demoCA/serial

echo 00 > /tmp/cert/demoCA/serial

b.生成CA私钥文件。

openssl genrsa -out os5500v3_ca.key 2048

c.生成CA证书请求。

openssl req -new -key os5500v3_ca.key -out os5500v3_ca.csr -config ssl.conf -subj "/C=CN/ST=SC/L=CD/O=Huawei/OU=Storage/CN=xxxx"

其中,上述内容里的"xxxx"需要修改为存储阵列的ESN号。

d.生成CA证书文件。

openssl x509 -req -days 3650 -in os5500v3_ca.csr -signkey os5500v3_ca.key -out os5500v3_ca.crt -extensions v3_ca -extfile ssl.conf

4.使用CA证书给证书请求文件签名。

mkdir /etc/pki/CA/newcerts

mkdir /tmp/cert/demoCA/newcerts

1)更改配置文件,以免证书请求的省份和组织名称与CA不匹配导致无法签名。

vi /etc/ssl/openssl.cnf

stateOrProvinceName = optional

organizationName = supplied

2)给双活仲裁证书请求签名。

openssl ca -days 3650 -in os5500v3_da.csr -out os5500v3_da.crt -cert os5500v3_ca.crt -keyfile os5500v3_ca.key -extfile ssl.conf

执行上述命令,根据回显提示输入"y"。回显示例如下。

Using configuration from /etc/ssl/openssl.cnf

Check that the request matches the signature

Signature ok

Certificate Details:

Serial Number: 0 (0x0)

Validity

Not Before: May 1 02:53:09 2025 GMT

Not After : May 2 02:53:09 2035 GMT

Subject:

countryName = CN

organizationName = Huawei

organizationalUnitName = Storage

commonName = xxx

Certificate is to be certified until May 2 02:53:09 2035 GMT (3650 days)

Sign the certificate? [y/n]:y

1 out of 1 certificate requests certified, commit? [y/n]y

Write out database with 1 new entries

Data Base Updated

验证证书有效。

openssl x509 -in os5500v3_da.crt -text -noout

3)更改以下两个配置文件,允许为同一个CN创建多个证书。

vi /etc/ssl/openssl.cnf

unique_subject = no # Set to 'no' to allow creation of several ctificates with same subject.

vi /tmp/hw5500/demoCA/index.txt.attr

unique_subject = no

4)使用同样的方法再给其他证书请求签名。

5.将生成的自签名证书和CA证书导入存储阵列。

登录DeviceManager。

选择"设置 > 存储设置> 证书管理"。

选择"证书",单击"导入证书"。


双活仲裁证书导入后证书的过期时间延长到2035年。

三、处理总结

1.此次故障首先尝试参考2链接中的方法利用存储内置的CA中心来签发证书,但是只有新型号的存储(OceanStor 6.1.5版本以上)才可以使用此方法,5500 V3中没有相应的命令。

2.在对证书请求签名的过程中遇到以下几个问题,在上面的步骤中已列出相应的方法来规避掉。

1)问题1:签名提示证书请求中的 stateOrProvinceName缺失导致签名失败,更改配置文件将相应的参数由匹配更改为可选。

Using configuration from /etc/ssl/openssl.cnf

Check that the request matches the signature

Signature ok

The mandatory stateOrProvinceName field was missing

解决方法:

vi /etc/ssl/openssl.cnf

stateOrProvinceName = optional

2)问题2:签名提示证书请求中的组织名称不同导致签名失败,但是输出都是"Huawei",更改配置文件中相应的参数来规避。

Using configuration from /etc/ssl/openssl.cnf

Check that the request matches the signature

Signature ok

The organizationName field needed to be the same in the

CA certificate (Huawei) and the request (Huawei)

解决方法:

vi /etc/ssl/openssl.cnf

organizationName = supplied

3)问题3:对第二个证书请求进行签名时报CN已经存在一个证书了,不能再签发新的证书。更改配置文件来允许对同一个CN签发多个证书。

Using configuration from /etc/ssl/openssl.cnf

Check that the request matches the signature

Signature ok

ERROR:There is already a certificate for /C=CN/O=Huawei/OU=Storage/CN=XXX

解决方法:

更改以下两个配置文件,允许为同一个CN创建多个证书。

vi /etc/ssl/openssl.cnf

unique_subject = no # Set to 'no' to allow creation of several ctificates with same subject.

vi /tmp/hw5500/demoCA/index.txt.attr

unique_subject = no

参考:

1.如何通过自签名证书的方法替换带内管理证书

2.获取存储设备ESN序列号

3.通过存储内置CA中心签发证书(适用于6.1.5及后续版本)

4.How do I issue multiple certificates for the same Common Name?

5.OpenSSL创建私有CA

6.harbor 反代 无法登录

相关推荐
_waylau2 小时前
华为首款鸿蒙电脑正式亮相
华为·电脑·harmonyos
IT小饕餮3 小时前
华为设备MSTP
运维·华为
RUZHUA5 小时前
华为首款鸿蒙电脑正式亮相,开启国产操作系统新篇章
华为·电脑·harmonyos
yuanlaile13 小时前
HarmonyOS 鸿蒙操作物联网设备蓝牙模块、扫描蓝牙、连接蓝牙和蓝牙通信
物联网·华为·harmonyos·鸿蒙蓝牙·harmonyos 蓝牙模块
鸿蒙布道师17 小时前
鸿蒙NEXT开发动画案例2
android·ios·华为·harmonyos·鸿蒙系统·arkui·huawei
HMS Core1 天前
【FAQ】HarmonyOS SDK 闭源开放能力 — PDF Kit
华为·pdf·harmonyos
二蛋和他的大花1 天前
HarmonyOS运动开发:如何集成百度地图SDK、运动跟随与运动公里数记录
华为·harmonyos
SuperHeroWu71 天前
【HarmonyOS 5】鸿蒙页面和组件生命周期函数
华为·harmonyos·鸿蒙·自定义组件·页面·生命周期函数
搞瓶可乐1 天前
鸿蒙ArkTs实战之截图保存图片到相册,详细教程,不使用SaveButton的方法,附上源码和效果图
华为·harmonyos·arkts·保存图片·操作沙箱·鸿蒙解决方案·媒体操作