配置数字证书
调用Open API是采用HTTPS方式,所以在建立HTTPS请求连接时需要导入自己的证书。
前提条件
- 停止eSight。
- 已申请证书,并获取证书密码。
操作步骤
- 登录eSight服务器。
- Windows系统请用Administrator用户登录eSight服务器。
- Linux系统请用root用户登录eSight服务器。
- 将后缀为“.jks”格式的证书上传至eSight安装目录/AppBase/etc/certificate/application/node目录下。
SUSE和Euler场景中,在eSight安装目录/AppBase/etc/certificate/application/node目录下执行以下命令修改证书权限为ossuser:ossgroup。
chown ossuser:ossgroup customKeyStore.jks
证书格式要求后缀为“.jks”,假设“.jks”格式的证书存档文件的名称为“customKeyStore.jks”。
- 检查证书信息。
在eSight安装目录/AppBase/etc/certificate/application/node目录下执行以下命令:
eSight安装目录/AppBase/jre/bin/keytool -list -v -keystore customKeyStore.jks -storepass example@123
example@123为证书密码。此处只是示例,非真实密码。详情可以联系华为工程师。
回显如下:
Creation date: Aug 25, 2021 Entry type: PrivateKeyEntry Certificate chain length: 2 Certificate[1]: Owner: CN=10.93.107.108, OU=spo, O=huawei, ST=guangdong, C=cn Issuer: C=cn, L=shenzhen, O=huawei, OU=huawei, CN=CA Serial number: 1adc Valid from: Wed Aug 25 08:45:08 CST 2021 until: Sat Aug 23 08:45:08 CST 2031 Certificate fingerprints: SHA1: DA:BF:B5:89:28:B2:22:2F:60:B3:72:B7:05:BA:76:91:0E:5B:9A:22 SHA256: AC:E0:07:BD:C8:93:D2:F4:65:41:8B:E3:54:F6:BA:05:BB:8E:79:16:3D:FA:E1:8E:BD:87:88:5B:23:38:F7:BF Signature algorithm name: SHA256withECDSA Subject Public Key Algorithm: 256-bit EC (secp256r1) key (3) Version: {10} Extensions: #1: ObjectId: 2.16.840.1.113730.1.13 Criticality=false 0000: 16 1D 4F 70 65 6E 53 53 4C 20 47 65 6E 65 72 61 ..OpenSSL Genera 0010: 74 65 64 20 43 65 72 74 69 66 69 63 61 74 65 ted Certificate #2: ObjectId: 2.5.29.35 Criticality=false AuthorityKeyIdentifier [ KeyIdentifier [ 0000: 87 59 01 8E 61 23 E2 8E FF A2 FC 61 B8 1D F9 AB .Y..a#.....a.... 0010: 13 3F ED 7B .?.. ] ] #3: ObjectId: 2.5.29.19 Criticality=false BasicConstraints:[ CA:false PathLen: undefined ] #4: ObjectId: 2.5.29.14 Criticality=false SubjectKeyIdentifier [ KeyIdentifier [ 0000: 15 4F C9 27 DB A2 45 78 60 EE 2B B1 E9 38 9C 69 .O.'..Ex`.+..8.i 0010: 8E A4 97 BD .... ] ] Certificate[2]: Owner: C=cn, L=shenzhen, O=huawei, OU=huawei, CN=CA Issuer: C=cn, L=shenzhen, O=huawei, OU=huawei, CN=CA Serial number: 22a62345f6ffd47fec047e021976d4d35df9d9c6 Valid from: Wed Aug 25 08:45:05 CST 2021 until: Sat Aug 23 08:45:05 CST 2031 Certificate fingerprints: SHA1: 4C:B2:AD:5B:4B:B6:73:3E:BF:AB:DF:A0:52:57:01:97:CC:6E:A9:B8 SHA256: EF:BF:A6:A1:F3:8B:07:5D:11:5C:C6:8C:AA:59:4F:A4:84:DF:17:C3:FD:A5:07:5B:E9:80:29:0F:98:6E:21:4C Signature algorithm name: SHA256withECDSA Subject Public Key Algorithm: 256-bit EC (secp256r1) key (3) Version: {10} Extensions: #1: ObjectId: 2.5.29.35 Criticality=false AuthorityKeyIdentifier [ KeyIdentifier [ 0000: 87 59 01 8E 61 23 E2 8E FF A2 FC 61 B8 1D F9 AB .Y..a#.....a.... 0010: 13 3F ED 7B .?.. ] ] #2: ObjectId: 2.5.29.19 Criticality=false BasicConstraints:[ CA:true PathLen:2147483647 ] #3: ObjectId: 2.5.29.14 Criticality=false SubjectKeyIdentifier [ KeyIdentifier [ 0000: 87 59 01 8E 61 23 E2 8E FF A2 FC 61 B8 1D F9 AB .Y..a#.....a.... 0010: 13 3F ED 7B .?.. ] ]
上述回显内容仅为示例。启动过程中会校验证书密码和有效期。
表3-1 证书信息的部分字段及要求信息
中文名
示例
要求
Signature algorithm
签名算法
sha256WithRSAEncryption
必须是 sha256WithRSAEncryption 。
Validity
有效期
-
当前时间必须在此区间内,否则证书过期。
Public Key Algorithm
公钥算法
rsaEncryption
必须是 rsaEncryption 。
- 将证书相对路径(从etc目录开始)配置到ros_config_esight.xml中的webservers/rosOpenAPIROA/connectors/openapiROAConnector/ssl.keystore.path配置项。
例如:<property name="ssl.keystore.path" value="etc/certificate/application/node/customKeyStore.jks" />。
ros_config_esight.xml路径为:eSight安装目录/AppBase/etc/oms.ros/。
- 将证书密码密文配置到ros_config_esight.xml中的webservers/rosOpenAPIROA/connectors/openapiROAConnector/ssl.keystore.password配置项。例如:<property name="ssl.keystore.password" value="9d7961bc8af54d05ce509e03b13ffce3abc7587373e7719b62555fd5aff9908d" />。
- 在Windows操作系统中,需要使用“eSight安装目录/AppBase/tools/bmetool/encrypt/encrypt.bat”工具来加密存储密码,命令格式为encrypt.bat 0。
- 在Linux操作系统中,需要使用“eSight安装目录/AppBase/tools/bmetool/encrypt/encrypt.sh”工具来加密存储密码,命令格式为./encrypt.sh 0。
- 保存配置,重启eSight生效。