在新 OS X 安装上安装 Homebrew 时出现问题(SSL 错误)
Problems installing Homebrew on a new OS X installation (SSL error)
在此处进行全新的 OS X 安装(新 VM),并且在尝试安装 Homebrew 时出现 SSL 错误。
fatal: unable to access 'https://github.com/Homebrew/homebrew/': Unknown SSL protocol error in connection to github.com:-9847
Failed during: git fetch origin master:refs/remotes/origin/master -n --depth=1
这是我正在使用的命令:
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
仔细检查并尝试添加 --insecure(或 -k)并从 https 中删除 s,但它似乎没有帮助。使用 --insecure 我只是让服务器中止了 SSL 握手。
有人知道这里出了什么问题吗? “xcode-select --install”也已 运行。
编辑:按照下面的建议,我将使用 tcpdump 打包的文件转储到 pcap 文件中,然后使用 tshark 打开它。从中我得到:
1 0.000000 MY_IP_REMOVED -> 192.30.252.130 TCP 78 49451→443 [SYN]
Seq=0 Win=65535 Len=0 MSS=1460 WS=32 TSval=170479114 TSecr=0
SACK_PERM=1
2 0.128228 192.30.252.130 -> MY_IP_REMOVED TCP 78
443→49451 [SYN, ACK] Seq=0 Ack=1 Win=14240 Len=0 MSS=1436 SACK_PERM=1
TSval=2830778812 TSecr=170479114 WS=1024 [ETHERNET FRAME CHECK
SEQUENCE INCORRECT]
3 0.128303 MY_IP_REMOVED -> 192.30.252.130 TCP
66 49451→443 [ACK] Seq=1 Ack=1 Win=132416 Len=0 TSval=170479237
TSecr=2830778812
4 0.150128 MY_IP_REMOVED -> 192.30.252.130 SSL
255 Client Hello
5 0.150913 192.30.252.130 -> MY_IP_REMOVED SSL
1158 Continuation Data [ETHERNET FRAME CHECK SEQUENCE INCORRECT]
6 0.150916 192.30.252.130 -> 81.26.52.196 TCP 64 443→49451 [FIN, ACK] Seq=1101 Ack=190 Win=4237312 Len=0 [ETHERNET FRAME CHECK SEQUENCE
INCORRECT]
7 0.150961 MY_IP_REMOVED -> 192.30.252.130 TCP 66
49451→443 [ACK] Seq=190 Ack=1101 Win=131328 Len=0 TSval=170479257
TSecr=2830778812
8 0.150990 MY_IP_REMOVED -> 192.30.252.130 TCP 66
49451→443 [ACK] Seq=190 Ack=1102 Win=131328 Len=0 TSval=170479257
TSecr=2830778812
9 0.151046 MY_IP_REMOVED -> 192.30.252.130 TCP 66
49451→443 [FIN, ACK] Seq=190 Ack=1102 Win=132416 Len=0 TSval=170479257
TSecr=2830778812
10 0.151156 192.30.252.130 -> MY_IP_REMOVED TCP 64
443→49451 [RST] Seq=1102 Win=4237312 Len=0 [ETHERNET FRAME CHECK
SEQUENCE INCORRECT]
如果这是 OS X 的全新安装,我怀疑该问题可能是 SecureTransport
中的一个罕见问题(错误?),可能由您路由中某处的代理或防火墙设置触发到 git 中心。
您的 libcurl
是针对 Security.framework
编译的。错误代码 -9847
表示 Record overflow:
A record overflow occurred.
Value
–9847
Description
A record overflow occurred.
Available in OS X v10.3 and later.
错误可能在 tls1Callouts.c 中的这一行。客户端似乎收到了一条非预期长度的记录。
可能与类似的issue in gnutls:有关。
There are several issues with TLS connections and the F5 firewall, and
that looks like the case. That firewall terminates a TLS session if
the client hello is between 256 and 512 bytes. If that is the case you
can verify using wireshark.
The solution we adopted in later versions
of gnutls is to add padding:
https://gitlab.com/gnutls/gnutls/commit/b6d29bb1737f96ac44a8ef9cc9fe7f9837e20465
您可以尝试使用 tcpdump/wireshark 进一步调查(将 en0 替换为您的接口名称):
$ sudo tcpdump -i en0 —n -s 0 -B 524288 -w test.pcap port 443
在 Wireshark 中查看您的 pcap
文件(或直接在 Wireshark 中捕获)以获取有关每个阶段的详细信息。 www.sans.org上SSL/TLS
有很好的解释。为了比较,我的(成功的)对话是这样的:
$ tshark -r test.pcap
1 0.000000 10.0.0.125 -> 192.30.252.129 TCP 78 51229→443 [SYN] Seq=0 Win=65535 Len=0 MSS=1460 WS=32 TSval=235773429 TSecr=0 SACK_PERM=1
2 0.133049 192.30.252.129 -> 10.0.0.125 TCP 74 443→51229 [SYN, ACK] Seq=0 Ack=1 Win=14240 Len=0 MSS=1460 SACK_PERM=1 TSval=1851779047 TSecr=235773429 WS=1024
3 0.133148 10.0.0.125 -> 192.30.252.129 TCP 66 51229→443 [ACK] Seq=1 Ack=1 Win=131744 Len=0 TSval=235773562 TSecr=1851779047
4 0.138296 10.0.0.125 -> 192.30.252.129 SSL 255 Client Hello
5 0.278168 192.30.252.129 -> 10.0.0.125 TLSv1.2 1490 Server Hello
6 0.278567 192.30.252.129 -> 10.0.0.125 TLSv1.2 1490 Certificate
7 0.278696 10.0.0.125 -> 192.30.252.129 TCP 66 51229→443 [ACK] Seq=190 Ack=2849 Win=129632 Len=0 TSval=235773707 TSecr=1851779083
8 0.278910 192.30.252.129 -> 10.0.0.125 TLSv1.2 399 Server Key Exchange
9 0.278991 10.0.0.125 -> 192.30.252.129 TCP 66 51229→443 [ACK] Seq=190 Ack=3182 Win=130720 Len=0 TSval=235773707 TSecr=1851779083
10 0.339768 10.0.0.125 -> 192.30.252.129 TLSv1.2 141 Client Key Exchange
11 0.551009 192.30.252.129 -> 10.0.0.125 TCP 66 443→51229 [ACK] Seq=3182 Ack=265 Win=15360 Len=0 TSval=1851779144 TSecr=235773767
12 0.551185 10.0.0.125 -> 192.30.252.129 TLSv1.2 157 Change Cipher Spec, Encrypted Handshake Message
13 0.688512 192.30.252.129 -> 10.0.0.125 TCP 66 443→51229 [ACK] Seq=3182 Ack=356 Win=15360 Len=0 TSval=1851779186 TSecr=235773977
14 0.691643 192.30.252.129 -> 10.0.0.125 TLSv1.2 157 Change Cipher Spec, Encrypted Handshake Message
15 0.691720 10.0.0.125 -> 192.30.252.129 TCP 66 51229→443 [ACK] Seq=356 Ack=3273 Win=130976 Len=0 TSval=235774117 TSecr=1851779186
16 0.692351 10.0.0.125 -> 192.30.252.129 TLSv1.2 215 Application Data
如果确实如此,您的解决方法可能是编译自定义 libcurl
并支持 openssl
并使 git 使用您的新 libcurl
。或者,您可以使用 ssh
而不是 https
来连接到 github(如果您在 github 注册了 public 密钥)。
如果您只是想要一个解决方法来安装 Homebrew,您可以尝试使用其他工具下载它的安装脚本。例如。像这样:
$ python -c "import urllib ; urllib.urlretrieve('https://raw.githubusercontent.com/Homebrew/install/master/install', 'install.rb')"
$ ruby install.rb
在此处进行全新的 OS X 安装(新 VM),并且在尝试安装 Homebrew 时出现 SSL 错误。
fatal: unable to access 'https://github.com/Homebrew/homebrew/': Unknown SSL protocol error in connection to github.com:-9847
Failed during: git fetch origin master:refs/remotes/origin/master -n --depth=1
这是我正在使用的命令:
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
仔细检查并尝试添加 --insecure(或 -k)并从 https 中删除 s,但它似乎没有帮助。使用 --insecure 我只是让服务器中止了 SSL 握手。
有人知道这里出了什么问题吗? “xcode-select --install”也已 运行。
编辑:按照下面的建议,我将使用 tcpdump 打包的文件转储到 pcap 文件中,然后使用 tshark 打开它。从中我得到:
1 0.000000 MY_IP_REMOVED -> 192.30.252.130 TCP 78 49451→443 [SYN] Seq=0 Win=65535 Len=0 MSS=1460 WS=32 TSval=170479114 TSecr=0 SACK_PERM=1
2 0.128228 192.30.252.130 -> MY_IP_REMOVED TCP 78 443→49451 [SYN, ACK] Seq=0 Ack=1 Win=14240 Len=0 MSS=1436 SACK_PERM=1 TSval=2830778812 TSecr=170479114 WS=1024 [ETHERNET FRAME CHECK SEQUENCE INCORRECT]
3 0.128303 MY_IP_REMOVED -> 192.30.252.130 TCP 66 49451→443 [ACK] Seq=1 Ack=1 Win=132416 Len=0 TSval=170479237 TSecr=2830778812
4 0.150128 MY_IP_REMOVED -> 192.30.252.130 SSL 255 Client Hello
5 0.150913 192.30.252.130 -> MY_IP_REMOVED SSL 1158 Continuation Data [ETHERNET FRAME CHECK SEQUENCE INCORRECT]
6 0.150916 192.30.252.130 -> 81.26.52.196 TCP 64 443→49451 [FIN, ACK] Seq=1101 Ack=190 Win=4237312 Len=0 [ETHERNET FRAME CHECK SEQUENCE INCORRECT]7 0.150961 MY_IP_REMOVED -> 192.30.252.130 TCP 66 49451→443 [ACK] Seq=190 Ack=1101 Win=131328 Len=0 TSval=170479257 TSecr=2830778812
8 0.150990 MY_IP_REMOVED -> 192.30.252.130 TCP 66 49451→443 [ACK] Seq=190 Ack=1102 Win=131328 Len=0 TSval=170479257 TSecr=2830778812
9 0.151046 MY_IP_REMOVED -> 192.30.252.130 TCP 66 49451→443 [FIN, ACK] Seq=190 Ack=1102 Win=132416 Len=0 TSval=170479257 TSecr=2830778812
10 0.151156 192.30.252.130 -> MY_IP_REMOVED TCP 64 443→49451 [RST] Seq=1102 Win=4237312 Len=0 [ETHERNET FRAME CHECK SEQUENCE INCORRECT]
如果这是 OS X 的全新安装,我怀疑该问题可能是 SecureTransport
中的一个罕见问题(错误?),可能由您路由中某处的代理或防火墙设置触发到 git 中心。
您的 libcurl
是针对 Security.framework
编译的。错误代码 -9847
表示 Record overflow:
A record overflow occurred.
Value
–9847
Description
A record overflow occurred.
Available in OS X v10.3 and later.
错误可能在 tls1Callouts.c 中的这一行。客户端似乎收到了一条非预期长度的记录。
可能与类似的issue in gnutls:有关。
There are several issues with TLS connections and the F5 firewall, and that looks like the case. That firewall terminates a TLS session if the client hello is between 256 and 512 bytes. If that is the case you can verify using wireshark.
The solution we adopted in later versions of gnutls is to add padding: https://gitlab.com/gnutls/gnutls/commit/b6d29bb1737f96ac44a8ef9cc9fe7f9837e20465
您可以尝试使用 tcpdump/wireshark 进一步调查(将 en0 替换为您的接口名称):
$ sudo tcpdump -i en0 —n -s 0 -B 524288 -w test.pcap port 443
在 Wireshark 中查看您的 pcap
文件(或直接在 Wireshark 中捕获)以获取有关每个阶段的详细信息。 www.sans.org上SSL/TLS
有很好的解释。为了比较,我的(成功的)对话是这样的:
$ tshark -r test.pcap
1 0.000000 10.0.0.125 -> 192.30.252.129 TCP 78 51229→443 [SYN] Seq=0 Win=65535 Len=0 MSS=1460 WS=32 TSval=235773429 TSecr=0 SACK_PERM=1
2 0.133049 192.30.252.129 -> 10.0.0.125 TCP 74 443→51229 [SYN, ACK] Seq=0 Ack=1 Win=14240 Len=0 MSS=1460 SACK_PERM=1 TSval=1851779047 TSecr=235773429 WS=1024
3 0.133148 10.0.0.125 -> 192.30.252.129 TCP 66 51229→443 [ACK] Seq=1 Ack=1 Win=131744 Len=0 TSval=235773562 TSecr=1851779047
4 0.138296 10.0.0.125 -> 192.30.252.129 SSL 255 Client Hello
5 0.278168 192.30.252.129 -> 10.0.0.125 TLSv1.2 1490 Server Hello
6 0.278567 192.30.252.129 -> 10.0.0.125 TLSv1.2 1490 Certificate
7 0.278696 10.0.0.125 -> 192.30.252.129 TCP 66 51229→443 [ACK] Seq=190 Ack=2849 Win=129632 Len=0 TSval=235773707 TSecr=1851779083
8 0.278910 192.30.252.129 -> 10.0.0.125 TLSv1.2 399 Server Key Exchange
9 0.278991 10.0.0.125 -> 192.30.252.129 TCP 66 51229→443 [ACK] Seq=190 Ack=3182 Win=130720 Len=0 TSval=235773707 TSecr=1851779083
10 0.339768 10.0.0.125 -> 192.30.252.129 TLSv1.2 141 Client Key Exchange
11 0.551009 192.30.252.129 -> 10.0.0.125 TCP 66 443→51229 [ACK] Seq=3182 Ack=265 Win=15360 Len=0 TSval=1851779144 TSecr=235773767
12 0.551185 10.0.0.125 -> 192.30.252.129 TLSv1.2 157 Change Cipher Spec, Encrypted Handshake Message
13 0.688512 192.30.252.129 -> 10.0.0.125 TCP 66 443→51229 [ACK] Seq=3182 Ack=356 Win=15360 Len=0 TSval=1851779186 TSecr=235773977
14 0.691643 192.30.252.129 -> 10.0.0.125 TLSv1.2 157 Change Cipher Spec, Encrypted Handshake Message
15 0.691720 10.0.0.125 -> 192.30.252.129 TCP 66 51229→443 [ACK] Seq=356 Ack=3273 Win=130976 Len=0 TSval=235774117 TSecr=1851779186
16 0.692351 10.0.0.125 -> 192.30.252.129 TLSv1.2 215 Application Data
如果确实如此,您的解决方法可能是编译自定义 libcurl
并支持 openssl
并使 git 使用您的新 libcurl
。或者,您可以使用 ssh
而不是 https
来连接到 github(如果您在 github 注册了 public 密钥)。
如果您只是想要一个解决方法来安装 Homebrew,您可以尝试使用其他工具下载它的安装脚本。例如。像这样:
$ python -c "import urllib ; urllib.urlretrieve('https://raw.githubusercontent.com/Homebrew/install/master/install', 'install.rb')"
$ ruby install.rb