Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SSL routines :unsafe legacy renegotiation disabled #1064

Closed
Fredida opened this issue Apr 20, 2024 · 7 comments
Closed

SSL routines :unsafe legacy renegotiation disabled #1064

Fredida opened this issue Apr 20, 2024 · 7 comments

Comments

@Fredida
Copy link

Fredida commented Apr 20, 2024

用Whistle做MITM proxy访问网站时发生下面的错误:

From: whistle@2.9.68 Node: v20.12.2 Error: 444E0000:error:0A000152:SSL routines:final_renegotiate:unsafe legacy renegotiation disabled:c:\ws\deps\openssl\openssl\ssl\statem\extensions.c:922:

查Stackoverflow得知因为CVE-2009-3555,Node.js 18+ 默认关闭了OpenSSL中TLS unsafe legacy renegotiation,导致与使用旧版(1.1.x) OpenSSL的服务器连接失败。尝试用自定义OpenSSL配置文件(新建openssl.cnf填充配置并加入Options = UnsafeLegacyRenegotiation)启动:
node --openssl-config=openssl.cnf node_modules\whistle\bin\whistle.js run

依然失败,这时看到有人说在代码里处理request和response时可以加入crypto.constants.SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION

因为不熟悉whistle,请指点应该怎样修改(如果能增加程序启动选项支持就更好了)

参考:
https://stackoverflow.com/questions/74324019/allow-legacy-renegotiation-for-nodejs
https://johnnyreilly.com/node-18-axios-and-unsafe-legacy-renegotiation-disabled
https://stackoverflow.com/questions/76670346/node-js-18-16-1-fetcherror-unsafe-legacy-renegotiation

@avwo
Copy link
Owner

avwo commented Apr 21, 2024

报错的链接发我下

@Fredida
Copy link
Author

Fredida commented Apr 21, 2024

@avwo
Copy link
Owner

avwo commented Apr 22, 2024

重新安装 Whistle 并重启试试

@Fredida
Copy link
Author

Fredida commented Apr 23, 2024

重新安装 Whistle 并重启试试

无用,唯一有效的临时解决方案是卸载Node.js 20 LTS,降级安装Node.js 16,利用旧版本Node.js默认情况下开启OpenSSL的legacy renegotiation配置的特性,可无错访问到使用旧版(1.1.x)OpenSSL的server端。但也会在另一些情况下带来新的SSL问题。所以还是希望能在Whistle代码中显式crypto.constants.SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION

@avwo
Copy link
Owner

avwo commented Apr 23, 2024

看下 Whistle 是不是最新版本 2.9.69:

npm i -g whistle --registry=https://registry.npmmirror.com && w2 restart

@Fredida
Copy link
Author

Fredida commented Apr 24, 2024

用yarn管理包,在yarn upgrade whistle显式升级之后:
yarn whistle version输出2.9.69
再打开之前报错的链接,已能顺利访问,感谢作者的帮助。
顺带一问,这个commit解决这个问题主要修改的是biz/webui/htdocs/js/index.js?这应该是和whistle的web界面相关?

@avwo
Copy link
Owner

avwo commented Apr 24, 2024

@avwo avwo closed this as completed Apr 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants