【问题标题】:SSL/TLS handshake error after client key exchange客户端密钥交换后的 SSL/TLS 握手错误
【发布时间】:2016-09-16 07:13:24
【问题描述】:

我正在尝试实施基于证书的身份验证,但在 SSL/TLS 握手期间出现错误。我尝试使用openssl s_client -state -debug -connect example.si:443 对其进行调试,但老实说我不够精通,无法解释输出:

http://pastebin.com/7BiJXeAY

据我所知,证书链已经过正确验证(我也检查过here),并且在设置Apache 2.2 服务器上的 VirtualHost:

<VirtualHost *:443>
   DocumentRoot D:/www/authentication
   ServerName lpt.uni-mb.si
   ServerAlias lpt.uni-mb.si
   SSLEngine on
   SSLCertificateFile "C:\Program Files (x86)\Apache Software Foundation\Apache2.2\conf\ssl\22_lpt.uni-mb.si.crt"
   SSLCACertificateFile "C:\Program Files (x86)\Apache Software Foundation\Apache2.2\conf\ssl\root.crt"
   SSLCertificateKeyFile "C:\Program Files (x86)\Apache Software Foundation\Apache2.2\conf\ssl\server.key"
   SSLCertificateChainFile "C:\Program Files (x86)\Apache Software Foundation\Apache2.2\conf\ssl\11_Intermediate.crt"
   SSLProtocol all -SSLv2 -SSLv3
   SSLCipherSuite HIGH:!aNULL:!MD5:!RC4
   SSLVerifyClient require
   SSLVerifyDepth  10
   SSLOptions +StdEnvVars +ExportCertData
   <Directory "D:/www/authentication">
       Options Indexes Includes
       AllowOverride All
       Order Deny,Allow
       Allow from all
       Options +FollowSymlinks
   </Directory>
</VirtualHost>

考虑到非常短的写入操作,可能是客户端密钥交换存在问题吗?

【问题讨论】:

  • 虽然它不能解决您的问题,但您不应允许使用过时的 SSLv2/v3 风格,而应仅配置 TLS:SSLProtocol all -SSLv2 -SSLv3
  • 在使用s_client 使用证书测试相互认证时,您需要指定证书和密钥。另请参阅s_client man page

标签: apache ssl client-certificates handshake


【解决方案1】:

据我从您的 pastebin 链接中可以看出,您发布了:

openssl s_client -state -debug
    -CAfile "C:\Program Files (x86)\Apache Software Foundation\Apache 2.2\conf\ssl\root.crt"
    -connect lpt.uni-mb.si:443

但您没有提供客户端证书。尝试使用证书/密钥文件添加 openssl 的 -cert-key 参数。

【讨论】:

  • 通过提供-key server.key -cert lpt.uni-mb.si.pem -CAfile root.crt,文件末尾的错误变为SSL_connect:error in SSLv3 write change cipher spec A。我是否提供了错误的密钥、证书和 CA?
  • 您混淆了服务器和客户端证书:22_lpt.uni-mb.si.crtserver.key 是服务器的证书/密钥,完全独立于客户端证书/密钥。通过配置SSLVerifyClient require。您希望客户出示使用您的 CA 证书 (root.crt) 签名的证书。 openssl 只需要这个来连接。
  • 你是对的。我必须下载客户端的 .pfx,然后提取公共证书和私钥,并提供它们 - 然后它就起作用了。哦,还有一件事……似乎浏览器中缺少链中的一个中间证书,所以我不得不手动添加它;不知道为什么。无论哪种方式,它现在都在工作。
  • 你成功了!顺便说一句,如果您想跟上安全性,使用 SSL labs server test 检查您的服务器非常有帮助。
猜你喜欢
  • 2016-05-04
  • 1970-01-01
  • 2016-06-07
  • 1970-01-01
  • 1970-01-01
  • 2016-02-13
  • 1970-01-01
  • 2019-08-18
  • 1970-01-01
相关资源
最近更新 更多