Facebook Ubuntu中的OpenSSL 1.0.1握手解决方案?

Facebook Ubuntu中的OpenSSL 1.0.1握手解决方案?,facebook,ubuntu,timeout,openssl,handshake,Facebook,Ubuntu,Timeout,Openssl,Handshake,我在Ubuntu 12.04上的OpenSSL 1.0.1中遇到了一个严重的错误: 连接到graph.facebook.com时,为什么要传递-cipher SRP-AES-256-CBC-SHA?Facebook当然不支持SRP: 如果你不通过考试,它能起作用吗 另外,你能给出你得到的IP地址吗?使用69.171.229.17,我可以复制准确的ClientHello(对nonce进行模化,使用RC4-SHA是保存SCSV的唯一密码),并且我成功地进行了握手 最后,您是否尝试过通过SSH隧道到

我在Ubuntu 12.04上的OpenSSL 1.0.1中遇到了一个严重的错误:


连接到
graph.facebook.com
时,为什么要传递
-cipher SRP-AES-256-CBC-SHA
?Facebook当然不支持SRP:

如果你不通过考试,它能起作用吗

另外,你能给出你得到的IP地址吗?使用69.171.229.17,我可以复制准确的ClientHello(对nonce进行模化,使用RC4-SHA是保存SCSV的唯一密码),并且我成功地进行了握手


最后,您是否尝试过通过SSH隧道到其他地方?不幸的是,在Chrome中部署TLS功能时,我们反复发现网络硬件破坏了TLS连接。(虽然我想不出-ssl3不会修复它的情况,除非硬件正在积极地检查连接。)

将我的Ubuntu盒上的MTU从1500设置为1496(由于我们的一个防火墙设置得太低),这样我就可以在不重新启动的情况下接收服务器的响应(请务必首先调用ifconfig并记下您的原始MTU,该MTU应为1500):

我通过使用连续较大的缓冲区ping来发现我的MTU(为UDP标头添加28个字节):

1472+28=1500时失败:

ping -s 1472 facebook.com
PING facebook.com (66.220.158.16) 1472(1500) bytes of data.
...
1468+28=1496的工程:

ping -s 1468 facebook.com
PING facebook.com (69.171.229.16) 1468(1496) bytes of data.
1476 bytes from www-slb-ecmp-06-prn1.facebook.com (69.171.229.16): icmp_req=1 ttl=242 time=30.0 ms
...
有了1496,我现在可以卷曲到facebook.com了:

curl -v https://facebook.com
* About to connect() to facebook.com port 443 (#0)
*   Trying 66.220.152.16... connected
* successfully set certificate verify locations:
*   CAfile: none
  CApath: /etc/ssl/certs
* SSLv3, TLS handshake, Client hello (1):
* SSLv3, TLS handshake, Server hello (2):
* SSLv3, TLS handshake, CERT (11):
* SSLv3, TLS handshake, Server finished (14):
* SSLv3, TLS handshake, Client key exchange (16):
* SSLv3, TLS change cipher, Client hello (1):
* SSLv3, TLS handshake, Finished (20):
* SSLv3, TLS change cipher, Client hello (1):
* SSLv3, TLS handshake, Finished (20):
* SSL connection using RC4-SHA
* Server certificate:
*        subject: C=US; ST=California; L=Palo Alto; O=Facebook, Inc.; CN=www.facebook.com
*        start date: 2012-06-21 00:00:00 GMT
*        expire date: 2013-12-31 23:59:59 GMT
*        subjectAltName: facebook.com matched
*        issuer: O=VeriSign Trust Network; OU=VeriSign, Inc.; OU=VeriSign International Server CA - Class 3; OU=www.verisign.com/CPS Incorp.by Ref. LIABILITY LTD.(c)97 VeriSign
*        SSL certificate verify ok.
> GET / HTTP/1.1
> User-Agent: curl/7.22.0 (x86_64-pc-linux-gnu) libcurl/7.22.0 OpenSSL/1.0.1 zlib/1.2.3.4 libidn/1.23 librtmp/2.3
> Host: facebook.com
> Accept: */*
>
< HTTP/1.1 301 Moved Permanently
< Location: https://www.facebook.com/
< Content-Type: text/html; charset=utf-8
< X-FB-Debug: 3vAg1O5OG9hB/EWC+gk1Kl3WLJRGmlQDaEodirWb+i0=
< Date: Wed, 28 Nov 2012 19:52:25 GMT
< Connection: keep-alive
< Content-Length: 0
<
* Connection #0 to host facebook.com left intact
* Closing connection #0
* SSLv3, TLS alert, Client hello (1):
curl-vhttps://facebook.com
*即将连接()到facebook.com端口443(#0)
*正在尝试66.220.152.16…已连接
*已成功设置证书验证位置:
*卡菲尔:没有
CApath:/etc/ssl/certs
*SSLv3,TLS握手,客户端hello(1):
*SSLv3,TLS握手,服务器hello(2):
*SSLv3,TLS握手,证书(11):
*SSLv3,TLS握手,服务器完成(14):
*SSLv3、TLS握手、客户端密钥交换(16):
*SSLv3,TLS更改密码,客户端你好(1):
*SSLv3,TLS握手,完成(20):
*SSLv3,TLS更改密码,客户端你好(1):
*SSLv3,TLS握手,完成(20):
*使用RC4-SHA的SSL连接
*服务器证书:
*主题:C=US;ST=California;L=Palo Alto;O=Facebook,Inc;CN=www.Facebook.com
*开始日期:2012-06-21 00:00:00 GMT
*过期日期:2013-12-31 23:59:59 GMT
*主题名称:facebook.com
*发行人:O=VeriSign Trust Network;OU=VeriSign,Inc;OU=VeriSign国际服务器CA-第3类;OU=www.VeriSign.com/CPS Incorp.by Ref.Responsibility LTD.(c)97 VeriSign
*SSL证书验证正常。
>GET/HTTP/1.1
>用户代理:curl/7.22.0(x86_64-pc-linux-gnu)libcurl/7.22.0 OpenSSL/1.0.1 zlib/1.2.3.4 libidn/1.23 librtmp/2.3
>主持人:facebook.com
>接受:*/*
>

我个人认为MTU应该与用户在TCP流级别看到的内容完全无关,所以我希望OpenSSL的人能解决这个问题。我也希望有人能发明一个自动的bug提交器,用于广泛存在且耗时的bug。

为什么
-密码SRP-AES-256-CBC-SHA
?我在尝试使用不同的密码只是为了得到任何响应。如果没有密码,它会在客户端hello发送后挂起,而我永远不会收到任何字节。对我来说,这是一个不错的开始:你的SO职业生涯。:-)无论我传递graph.facebook.com还是IP地址,它都会挂起,但我看到的是:ping graph.facebook.com ping api.facebook.com(69.171.234.22)56(84)字节的数据。来自api-read-slb-10-08-prn1.facebook.com(69.171.234.22)的64字节:icmp_req=1 ttl=242 time=30.2 msAlso,我同意你的观点,网络硬件可能是问题所在,它可能与MTU低于1500有关。但是,如果是这样的话,这是openssl中的一个缺陷,因为(IMHO)安全应该发生在流级别,而不是链路级别,因为无法知道数据包在野外是如何路由的。5分钟后我超时了,所以我不得不添加另一条评论。哦,我更新了我的问题,如果我没有传递密码,连接将挂起而不是返回错误。可能是您的网络阻塞了ICMP吗?如果MTU较低,则可能会出现路径MTU检测失败的情况。这解决了在vmware player 12.0.0 build-2985596(openssl软件包版本1.0.1f-1ubuntu2.15)中运行的Ubuntu 14.04.3 LTS上的问题。在我的例子中,MTU降低到1488。如果debian服务器上没有连接到特定主机,那么将MTU设置为1450,问题就解决了
CONNECTED(00000003)
SSL_connect:before/connect initialization
write to 0x14ed1a0 [0x1515bf0] (226 bytes => 226 (0xE2))
0000 - 16 03 01 00 dd 01 00 00-d9 03 02 50 b6 39 78 6a   ...........P.9xj
0010 - 24 95 8e dc 62 19 37 4b-ab 77 b8 66 cd 48 ba a2   $...b.7K.w.f.H..
0020 - a1 2a f8 1d f8 c9 5d fb-9d db 84 00 00 66 c0 14   .*....]......f..
0030 - c0 0a c0 22 c0 21 00 39-00 38 00 88 00 87 c0 0f   ...".!.9.8......
0040 - c0 05 00 35 00 84 c0 12-c0 08 c0 1c c0 1b 00 16   ...5............
0050 - 00 13 c0 0d c0 03 00 0a-c0 13 c0 09 c0 1f c0 1e   ................
0060 - 00 33 00 32 00 9a 00 99-00 45 00 44 c0 0e c0 04   .3.2.....E.D....
0070 - 00 2f 00 96 00 41 c0 11-c0 07 c0 0c c0 02 00 05   ./...A..........
0080 - 00 04 00 15 00 12 00 09-00 14 00 11 00 08 00 06   ................
0090 - 00 03 00 ff 02 01 00 00-49 00 0b 00 04 03 00 01   ........I.......
00a0 - 02 00 0a 00 34 00 32 00-0e 00 0d 00 19 00 0b 00   ....4.2.........
00b0 - 0c 00 18 00 09 00 0a 00-16 00 17 00 08 00 06 00   ................
00c0 - 07 00 14 00 15 00 04 00-05 00 12 00 13 00 01 00   ................
00d0 - 02 00 03 00 0f 00 10 00-11 00 23 00 00 00 0f 00   ..........#.....
00e0 - 01 01                                             ..
>>> TLS 1.1  [length 00dd]
    01 00 00 d9 03 02 50 b6 39 78 6a 24 95 8e dc 62
    19 37 4b ab 77 b8 66 cd 48 ba a2 a1 2a f8 1d f8
    c9 5d fb 9d db 84 00 00 66 c0 14 c0 0a c0 22 c0
    21 00 39 00 38 00 88 00 87 c0 0f c0 05 00 35 00
    84 c0 12 c0 08 c0 1c c0 1b 00 16 00 13 c0 0d c0
    03 00 0a c0 13 c0 09 c0 1f c0 1e 00 33 00 32 00
    9a 00 99 00 45 00 44 c0 0e c0 04 00 2f 00 96 00
    41 c0 11 c0 07 c0 0c c0 02 00 05 00 04 00 15 00
    12 00 09 00 14 00 11 00 08 00 06 00 03 00 ff 02
    01 00 00 49 00 0b 00 04 03 00 01 02 00 0a 00 34
    00 32 00 0e 00 0d 00 19 00 0b 00 0c 00 18 00 09
    00 0a 00 16 00 17 00 08 00 06 00 07 00 14 00 15
    00 04 00 05 00 12 00 13 00 01 00 02 00 03 00 0f
    00 10 00 11 00 23 00 00 00 0f 00 01 01
SSL_connect:unknown state
sudo ifconfig eth0 mtu 1496
ping -s 1472 facebook.com
PING facebook.com (66.220.158.16) 1472(1500) bytes of data.
...
ping -s 1468 facebook.com
PING facebook.com (69.171.229.16) 1468(1496) bytes of data.
1476 bytes from www-slb-ecmp-06-prn1.facebook.com (69.171.229.16): icmp_req=1 ttl=242 time=30.0 ms
...
curl -v https://facebook.com
* About to connect() to facebook.com port 443 (#0)
*   Trying 66.220.152.16... connected
* successfully set certificate verify locations:
*   CAfile: none
  CApath: /etc/ssl/certs
* SSLv3, TLS handshake, Client hello (1):
* SSLv3, TLS handshake, Server hello (2):
* SSLv3, TLS handshake, CERT (11):
* SSLv3, TLS handshake, Server finished (14):
* SSLv3, TLS handshake, Client key exchange (16):
* SSLv3, TLS change cipher, Client hello (1):
* SSLv3, TLS handshake, Finished (20):
* SSLv3, TLS change cipher, Client hello (1):
* SSLv3, TLS handshake, Finished (20):
* SSL connection using RC4-SHA
* Server certificate:
*        subject: C=US; ST=California; L=Palo Alto; O=Facebook, Inc.; CN=www.facebook.com
*        start date: 2012-06-21 00:00:00 GMT
*        expire date: 2013-12-31 23:59:59 GMT
*        subjectAltName: facebook.com matched
*        issuer: O=VeriSign Trust Network; OU=VeriSign, Inc.; OU=VeriSign International Server CA - Class 3; OU=www.verisign.com/CPS Incorp.by Ref. LIABILITY LTD.(c)97 VeriSign
*        SSL certificate verify ok.
> GET / HTTP/1.1
> User-Agent: curl/7.22.0 (x86_64-pc-linux-gnu) libcurl/7.22.0 OpenSSL/1.0.1 zlib/1.2.3.4 libidn/1.23 librtmp/2.3
> Host: facebook.com
> Accept: */*
>
< HTTP/1.1 301 Moved Permanently
< Location: https://www.facebook.com/
< Content-Type: text/html; charset=utf-8
< X-FB-Debug: 3vAg1O5OG9hB/EWC+gk1Kl3WLJRGmlQDaEodirWb+i0=
< Date: Wed, 28 Nov 2012 19:52:25 GMT
< Connection: keep-alive
< Content-Length: 0
<
* Connection #0 to host facebook.com left intact
* Closing connection #0
* SSLv3, TLS alert, Client hello (1):