我正在尝试构建一个 openssl 证书链,该证书链将与作为客户端的标准 CentOS 4 安装一起使用。 (我知道它很旧,但它是我们的客户正在使用的,因此我们需要支持它)。
第一个问题是 CentOS 4 openssl CA 包不包含所有现代证书,特别是 GoDaddy 根证书
/C=US/O=The Go Daddy Group, Inc./OU=Go Daddy Class 2 Certification Authority
所以我四处寻找,找到了上述证书的 Valicert 证书,并将其放入链中。openssl s_client
在 CentOS 5(openssl 0.9.8e)上运行时,此链可以验证,但在 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
此时有点困惑,任何想法都值得赞赏。
答案1
假设你的证书链中的证书#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 签名。因此, 的实际根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
。
我的某个系统上仍然有 OpenSSL 0.9.7,0.9.7d,不支持 SHA-2。它的日期是 2004 年,基础 0.9.7 显然是 2002 年 12 月,而 FIPS 180-2 是在 2002 年 8 月发布的。
我建议您检查您的实体证书;它也可能使用 SHA256 签名。您的 #1 显然是,gdig2.crt
这绝对是。如果是这样,这些在 0.9.7 中永远不会起作用;您没有在那里看到错误,因为它已经在链的上层失败了。
我不确定您是否能找到一个商业 CA,在 2014 年初 NIST 截止日期生效后向您颁发 SHA1 签名证书(和链);如果是这样,它可能不会保持有效期太久,然后您将再次面临同样的问题。如果客户端愿意更改其信任库(系统信任库,不更改代码)或您关心的任何客户端应用程序使用的用户存储,则您可以使用 openssl 为您的服务器密钥创建一个自签名的 SHA1 证书,并让客户端信任它。根据您的服务器,如果您可以将来自不合格客户端的请求划分到不同的端口或地址,您可能能够仅对他们使用自制的 SHA1 证书,而对其他所有人使用商业 SHA256 证书。