【已评审】新增rest接口响应用于表示证书是否满足安全要求

背景:

需求:

支持配置证书导入有效性校验,包括不安全算法,基本约束和密钥用法等

bmc已有部分校验不满足时拒绝证书, 但是部分证书导入缺少限制,根据规范要求,在证书导入时校验

根CA 要求 现状 计划
① 使用根CA证书中的公钥验证根CA证书中签名的正确性(验证根证书的签名是否由根证书中的公钥对应的私钥签发的); 强制校验 满足 保持现状
② 验证根CA证书处于有效期内; 强制校验 满足 保持现状
③ 如果是X.509 V3数字证书,验证根CA证书的“基本限制”扩展域是否标明为“CA”、“密钥用法”扩展域中是否包含“certificate signature、Certification Revocation List (CRL) signature” 强制校验 满足(不校验crl) 保持现状
④ 校验证书的数字签名算法是否满足安全要求,是否使用了不安全签名算法; 提示客户,客户确认后允许导入 不校验 增加web风险提示和安全日志记录
⑤ 校验证书的密钥长度是否满足要求,密钥长度应满足规定的长度要求; 提示客户,客户确认后允许导入 不校验 增加web风险提示和安全日志记录
端点证书(身份证书) 要求 服务器证书(私钥内部生成)现状 自定义证书现状 计划
① 验证设备证书的格式符合X.509v3标准; 基于产品策略拒绝 不校验 不校验 增加校验,失败后禁止导入
② 验证本产品持有与设备证书中包含公钥相对应的私钥; 基于产品策略拒绝 满足 满足 保持现状
③ 验证设备证书处于有效期内; 基于产品策略拒绝 满足 满足 保持现状
④ 验证证书持有者信息和设备唯一性信息是否匹配(需匿名保护或采用匿名证书的场景可不检查); 上述验证过程中④未通过时,如果发现与设备的唯一性信息不一致,则可以根据策略进行告警,但是产品应允许在操作人员知情情况下同意此证书的安装,以保证产品功能的可用性; 不校验 不校验 保持现状
⑤ 校验证书的数字签名算法是否满足安全要求,是否使用了不安全签名算法,或者算法参数使用不当(如使用了不安全的填充方式)。 产品应在界面提示操作人员该证书无法提供足够的安全性,但是产品允许在操作人员知情情况下继续安装此证书,以保证可用性。 有md5的弱签名算法校验 DES、RC4、MD5、SHA1、RSA1024以及DSA1024不安全算法校验 已有强制校验不变,新增算法增加web风险提示和安全日志记录
⑥ 校验证书的密钥长度是否满足要求,密钥长度应满足规定的长度要求;
产品应在界面提示操作人员该证书无法提供足够的安全性,但是产品允许在操作人员知情情况下继续安装此证书,以保证可用性。 不校验 DES、RC4、MD5、SHA1、RSA1024以及DSA1024不安全算法校验 已有强制校验不变,新增算法增加web风险提示和安全日志记录
⑦ 验证设备证书的“基本限制”扩展域是否标明为“End Entity” ,“密钥用法”扩展域中不能包含certificate signature、Certification Revocation
List (CRL) signature这两种密钥用法。
产品应在界面提示操作人员该证书无法提供足够的安全性,但是产品允许在操作人员知情情况下继续安装此证书,以保证可用性。 不校验 有end entity强制校验 取消强制校验并增加web风险提示和安全日志提示

方案

分别修改web,cli接口和资源协作接口

web接口:

在响应中增加字段 ValidateResult,为了扩展性,使用整型,0和1, 代表当前导入证书的安全性,前端页面在导入时,根据这个参数提示证书安全风险:
证书已成功导入,但该证书的部分属性(如签名算法、密钥长度、基本约束或者密钥用法)无法提供足够的安全性,请谨慎使用

涉及url有:ca和ssl证书导入
/UI/Rest/Services/WEBService/ImportCertificate
/UI/Rest/AccessMgnt/LDAP/:controllerid/ImportLDAPCertificate
/UI/Rest/AccessMgnt/CertMgnt/ImportCert
/UI/Rest/AccessMgnt/CertUpdateService/ImportClientCert

资源协作方法:

新增资源协作方法ImportCertificate

cli接口回显证书不安全
其他北向接口导入不安全证书时,记录安全日志
服务器证书:

Import public certificate successfully,but %s in the certificate does not meet security requirements
%s:signature algorithm,key length, basic constraints, key usages(四个名词组合)
如:
Import public certificate successfully, but signature algorithm, key length in the certificate does not meet security requirements
Import public certificate successfully, but signature algorithm, key length, basic constraints in the certificate does not meet security requirements

自定义证书:

Import custom certificate successfully,but %s in the certificate does not meet security requirements
%s:signature algorithm,key length, basic constraints, key usages(四个名词组合)
如:
Import custom certificate successfully, but signature algorithm, key length in the certificate does not meet security requirements
Import custom certificate successfully, but signature algorithm, key length, basic constraints in the certificate does not meet security requirements

CA证书

Import CA server CA certificate successfully,but %s in the certificate does not meet security requirements
%s:signature algorithm,key length, basic constraints, key usages(四个名词组合)
如:
Import CA server CA certificate successfully, but signature algorithm in the certificate does not meet security requirements
Import CA server CA certificate successfully, but signature algorithm, key length in the certificate does not meet security requirements

决策点1:webrest接口POST操作响应新增属性 ValidateResult 用于返回证书校验结果

uri
/UI/Rest/Services/WEBService/ImportCertificate
/UI/Rest/AccessMgnt/LDAP/:controllerid/ImportLDAPCertificate
/UI/Rest/AccessMgnt/CertMgnt/ImportCert
/UI/Rest/AccessMgnt/CertUpdateService/ImportClientCert
变化类型:新增属性(响应)
操作类型: POST
应用场景:用于返回证书校验结果
详细描述

属性名称 取值类型 说明 取值范围 默认值 操作权限 约束
ValidateResult integer 证书校验结果 0:导入成功,无安全风险 1:导入成功,有安全风险(导入失败错误引擎报错(已有)) 不涉及 不涉及

示例:新增属性

{
    "ValidateResult": 0
}

决策点2:证书导入类的CLI命令增加回显提示证书安全风险

CLI命令ipmcset -t certificate -d import -v <localpath/URL> <type> [passphrase](原有)
ipmcset -t syslog -d rootcertificate -v <filepath>(原有)
变化类型:新增命令导入成功回显
应用场景:导入证书成功,但是证书不安全
操作类型: SET
操作权限:SecurityMgmt

证书已成功导入,但该证书的部分属性(如签名算法、密钥长度、基本约束或者密钥用法)无法提供足够的安全性,请谨慎使用

Warning:The certificate fails to meet certain security standards, such as the signature algorithm, key length, basic constraints, or key usage. Exercise caution when using it.

决策点3:新增资源协作接口方法 ImportCertificate

path: /bmc/kepler/CertificateService (原有)
interface:bmc.kepler.CertificateService (原有)
变化类型:新增方法
应用场景: 导入证书
持久化类型: 不涉及
操作权限: 无
详细描述:远程任务导入时,实际校验结果在任务信息里

方法名称 变化类型 签名 读写&权限 持久化 变化通知 请求参数说明 响应参数说明 接口约束
ImportCertificate 新增方法 请求:issubsa{ss} 响应:uua{ss} SecurityMgmt NA NA CertificateUsageType:签名i,证书用途,0:CA,1:SSL,2:双因素客户端证书,4:固件完整性证书
Types:签名s,文件导入类型,可以是text或URI。text表示文本内容导入,URI表示文件导入
Content:签名s,证书文本内容或者文件路径,和Type配合,指定文件
Id:签名u,如果指定id则导入到对应的证书id下,如果id为0,则寻找一个可用id进行导入
WithEncryptedKey:签名b,证书文件是否携带私钥
Password:签名s,证书文件密码,密码可以为空
Extra:签名a{ss},预留扩展字段
Id:签名u,实际导入的证书Id
TaskId:签名u,异步任务Id,仅远程上传涉及
Extra:签名a{ss},预留扩展字段
当Type为text时,Content字段为证书内容,为URI时可以是本地或者远程文件,本地文件需要在/tmp/目录下
当WithEncryptedKey为true时Password有效

评审结论

决策点一

同意在如下webrest接口的POST操作响应中增加属性ValidateResult,类型为integer,表示证书导入时安全校验结果,0表示导入成功且无安全风险,1表示导入成功但是有安全风险
/UI/Rest/Services/WEBService/ImportCertificate
/UI/Rest/AccessMgnt/LDAP/:controllerid/ImportLDAPCertificate
/UI/Rest/AccessMgnt/CertMgnt/ImportCert
/UI/Rest/AccessMgnt/CertUpdateService/ImportClientCert

遗留问题
1、针对WebRest的Post场景,明确在执行成功的场景返回信息提示用户的实现策略
结论:已确认,当前框架不支持在资源协作接口方法返回错误时同时返回额外信息,因此在响应体增加属性,基于该属性区分用户提示

决策点二

同意当导入的证书不满足安全要求时,如下CLI接口导入成功时增加Warning回显:
ipmcset -t certificate -d import -v <localpath/URL> <type> [passphrase]
ipmcset -t syslog -d rootcertificate -v <filepath>

Warning:The certificate fails to meet certain security standards, such as the signature algorithm, key length, basic constraints, or key usage. Exercise caution when using it.

决策点三:

同意资源协作接口bmc.kepler.CertificateService新增方法

  • ImportCertificate,用于导入证书,包含ssl,ca,客户端证书等,请求签名为issubsa{ss},响应签名为uua{ss},参数详细说明参考评审点详细描述,权限为SecurityMgmt