我们正在与 AWS Nitro 合作,它仅提供 3 小时的证书。
我们正在寻找一种方法,可以跳过验证中的过期部分,并仍然确认证书链有效。
根据 openssl-verify 文档
-attime timestamp
Perform validation checks using time specified by timestamp and not current system time. timestamp is the number of seconds since 01.01.1970 (UNIX time).
如果您将标志的值指定为到期前的某个时间,它将帮助您跳过到期检查,因为它将始终返回 true。
您可以将
-days
选项与 x509
命令一起使用。
例如:
openssl x509 -days
我不确定 - 天与
openssl req
一起工作,因为有效性决定 x509
。
X509_V_FLAG_NO_CHECK_TIME
标志:
X509_STORE_set_flags (store, other_flags | X509_V_FLAG_NO_CHECK_TIME);
标志禁止根据当前时间检查证书和 CRL 的有效期。X509_V_FLAG_NO_CHECK_TIME
似乎没有办法在命令行上设置此选项。
对于
openssl
,标志是 -no_check_time
例如要验证 certA.pem 是否由您通常使用的 certB.pem 颁发:
不使用标志:
openssl verify -no-CAfile -no-CApath -partial_chain -trusted "certA.pem" "certB.pem"
输出:
error 10 at 0 depth lookup: certificate has expired
error certA.pem: verification failed
使用标志:
openssl verify -no_check_time -no-CAfile -no-CApath -partial_chain -trusted "certA.pem" "certB.pem"
输出带有标志:
certA.pem: OK