我正在尝试构建一个可与标准 CentOS 4 安装作为客户端一起使用的 openssl 证书链。(我知道它已经很老了,但它是我们的客户正在使用的,所以我们需要支持它)。
第一个问题是 CentOS 4 openssl CA 包不包含所有现代证书,特别是 GoDaddy 根证书
/C=US/O=The Go Daddy Group, Inc./OU=Go Daddy Class 2 Certification Authority
所以我四处挖掘并找到了上述证书的Valicert证书并将其放入链中。在 CentOS 5(即 openssl 0.9.8e)上运行openssl s_client
此链会验证,但在 CentOS 4(即 openssl 0.9.7a)上它不会验证。
CentOS 5 输出:
$ openssl s_client -CAfile /etc/pki/tls/certs/ca-bundle.crt -connect svn.example.org:443
CONNECTED(00000003)
depth=4 /L=ValiCert Validation Network/O=ValiCert, Inc./OU=ValiCert Class 2 Policy Validation Authority/CN=http://www.valicert.com//[email protected]
verify return:1
depth=3 /C=US/O=The Go Daddy Group, Inc./OU=Go Daddy Class 2 Certification Authority
verify return:1
depth=2 /C=US/ST=Arizona/L=Scottsdale/O=GoDaddy.com, Inc./CN=Go Daddy Root Certificate Authority - G2
verify return:1
depth=1 /C=US/ST=Arizona/L=Scottsdale/O=GoDaddy.com, Inc./OU=http://certs.godaddy.com/repository//CN=Go Daddy Secure Certificate Authority - G2
verify return:1
depth=0 /OU=Domain Control Validated/CN=*.example.org
verify return:1
---
Certificate chain
0 s:/OU=Domain Control Validated/CN=*.example.org
i:/C=US/ST=Arizona/L=Scottsdale/O=GoDaddy.com, Inc./OU=http://certs.godaddy.com/repository//CN=Go Daddy Secure Certificate Authority - G2
1 s:/C=US/ST=Arizona/L=Scottsdale/O=GoDaddy.com, Inc./OU=http://certs.godaddy.com/repository//CN=Go Daddy Secure Certificate Authority - G2
i:/C=US/ST=Arizona/L=Scottsdale/O=GoDaddy.com, Inc./CN=Go Daddy Root Certificate Authority - G2
2 s:/C=US/ST=Arizona/L=Scottsdale/O=GoDaddy.com, Inc./CN=Go Daddy Root Certificate Authority - G2
i:/C=US/O=The Go Daddy Group, Inc./OU=Go Daddy Class 2 Certification Authority
3 s:/C=US/O=The Go Daddy Group, Inc./OU=Go Daddy Class 2 Certification Authority
i:/L=ValiCert Validation Network/O=ValiCert, Inc./OU=ValiCert Class 2 Policy Validation Authority/CN=http://www.valicert.com//[email protected]
---
Server certificate
-----BEGIN CERTIFICATE-----
[ SNIP ]
-----END CERTIFICATE-----
subject=/OU=Domain Control Validated/CN=*.example.org
issuer=/C=US/ST=Arizona/L=Scottsdale/O=GoDaddy.com, Inc./OU=http://certs.godaddy.com/repository//CN=Go Daddy Secure Certificate Authority - G2
---
No client certificate CA names sent
---
SSL handshake has read 5697 bytes and written 319 bytes
---
New, TLSv1/SSLv3, Cipher is DHE-RSA-AES256-SHA
Server public key is 2048 bit
Secure Renegotiation IS supported
Compression: NONE
Expansion: NONE
SSL-Session:
Protocol : TLSv1
Cipher : DHE-RSA-AES256-SHA
Session-ID: [ SNIP ]
Session-ID-ctx:
Master-Key: [ SNIP ]
Key-Arg : None
Krb5 Principal: None
Start Time: 1394712184
Timeout : 300 (sec)
Verify return code: 0 (ok)
---
DONE
在 CentOS 4 上:
$ openssl s_client -CAfile /usr/share/ssl/certs/ca-bundle.crt -connect svn.example.org:443
CONNECTED(00000003)
depth=4 /L=ValiCert Validation Network/O=ValiCert, Inc./OU=ValiCert Class 2 Policy Validation Authority/CN=http://www.valicert.com//[email protected]
verify return:1
depth=3 /C=US/O=The Go Daddy Group, Inc./OU=Go Daddy Class 2 Certification Authority
verify return:1
depth=2 /C=US/ST=Arizona/L=Scottsdale/O=GoDaddy.com, Inc./CN=Go Daddy Root Certificate Authority - G2
verify error:num=7:certificate signature failure
verify return:0
---
Certificate chain
0 s:/OU=Domain Control Validated/CN=*.example.org
i:/C=US/ST=Arizona/L=Scottsdale/O=GoDaddy.com, Inc./OU=http://certs.godaddy.com/repository//CN=Go Daddy Secure Certificate Authority - G2
1 s:/C=US/ST=Arizona/L=Scottsdale/O=GoDaddy.com, Inc./OU=http://certs.godaddy.com/repository//CN=Go Daddy Secure Certificate Authority - G2
i:/C=US/ST=Arizona/L=Scottsdale/O=GoDaddy.com, Inc./CN=Go Daddy Root Certificate Authority - G2
2 s:/C=US/ST=Arizona/L=Scottsdale/O=GoDaddy.com, Inc./CN=Go Daddy Root Certificate Authority - G2
i:/C=US/O=The Go Daddy Group, Inc./OU=Go Daddy Class 2 Certification Authority
3 s:/C=US/O=The Go Daddy Group, Inc./OU=Go Daddy Class 2 Certification Authority
i:/L=ValiCert Validation Network/O=ValiCert, Inc./OU=ValiCert Class 2 Policy Validation Authority/CN=http://www.valicert.com//[email protected]
---
Server certificate
-----BEGIN CERTIFICATE-----
[ SNIP ]
-----END CERTIFICATE-----
subject=/OU=Domain Control Validated/CN=*.example.org
issuer=/C=US/ST=Arizona/L=Scottsdale/O=GoDaddy.com, Inc./OU=http://certs.godaddy.com/repository//CN=Go Daddy Secure Certificate Authority - G2
---
No client certificate CA names sent
---
SSL handshake has read 5697 bytes and written 343 bytes
---
New, TLSv1/SSLv3, Cipher is DHE-RSA-AES256-SHA
Server public key is 2048 bit
Secure Renegotiation IS supported
SSL-Session:
Protocol : TLSv1
Cipher : DHE-RSA-AES256-SHA
Session-ID: [ SNIP ]
Session-ID-ctx:
Master-Key: [ SNIP ]
Key-Arg : None
Krb5 Principal: None
Start Time: 1394712595
Timeout : 300 (sec)
Verify return code: 7 (certificate signature failure)
---
DONE
在这一点上有点困惑,任何想法都会受到赞赏。
假设您的链中的证书 #3 是https://certs.godaddy.com/anonymous/repository.pki
gdroot-g2_cross.crt
上带有 SHA1 指纹的证书84 1D 4A 9F C9 D3 B2 F0 CA 5F AB 95 52 5A B2 06 6A CF 83 22
,使用 SHA256WithRSA 签名。is 的实际根Go Daddy Root Certification Authority - G2
也是如此gdroot-g2.crt
47 BE AB C9 22 EA E8 0E 78 78 34 62 A7 9F 45 C2 54 FD E6 8B
,而不是您识别出的Go Daddy Secure Certificate Authority - G2
那个明显是中间的根gdig2.crt
27 AC 93 69 FA F2 52 07 BB 26 27 CE FA CC BE 4E F9 C3 19 B8
。我仍然在我的一个系统 0.9.7d 上使用的(一个)OpenSSL 0.9.7不支持 SHA-2。它的日期为 2004 年,基数 0.9.7 显然是 2002 年 12 月,而 FIPS 180-2 于 2002 年 8 月发布。
我建议您检查您的实体证书;它也可以用 SHA256 签名。你的#1显然是
gdig2.crt
肯定的。如果是这样,这些将永远无法在 0.9.7 中工作;您在那里没有看到错误,因为它已经在链条的上游失败了。我不确定你能找到一个商业 CA,它会在 NIST 截止日期于 2014 年初生效后向你颁发 SHA1 签名证书(和链);如果是这样,它可能不会保持有效很长时间,然后您将再次面临同样的问题。如果客户端愿意更改他们的信任库(系统之一,而不更改代码)或您关心的任何客户端应用程序使用的用户存储,您可以为您的服务器创建一个带有 SHA1 的自签名证书使用 openssl 的密钥并让客户端信任它。根据您的服务器,如果您可以将来自蹩脚客户端的请求分区到不同的端口或地址,您可能只能将自制的 SHA1 证书用于他们,而将商业 SHA256 证书用于其他人。