Bob*_*uck 12 linux soap openssl node.js
解决此问题的最佳方法是更新我尝试连接的 SSL 端点,但我也没有能力。
我正在尝试访问一个几乎没有维护的应用程序的 SOAP 端点(这很痛苦),因此可能无法获得正确的 SSL 补丁。
它位于正在执行主动 SSL 重写的代理后面,也可能是导致错误的原因:
var request = require("request")
var soap = require("soap")
const fs = require('fs')
var specialRequest = request.defaults({
ca: fs.readFileSync("rewrite-example.pem")
})
var options = { request: specialRequest }
const WSDL = "https://SSL-rewrite.example?wsdl"
soap.createClient(WSDL, options, function(err, client) {
if(err) throw Error(err)
})
Run Code Online (Sandbox Code Playgroud)
错误:
Uncaught TypeError: req.then is not a function
at HttpClient.request (../node_modules/soap/lib/http.js:191:13)
at Object.open_wsdl (../node_modules/soap/lib/wsdl/index.js:1271:20)
at openWsdl (../node_modules/soap/lib/soap.js:70:16)
at ../node_modules/soap/lib/soap.js:48:13
at _requestWSDL (../node_modules/soap/lib/soap.js:76:9)
at Object.createClient (../node_modules/soap/lib/soap.js:94:5)
> Uncaught: Error: write EPROTO C017726B8C7F0000:error:0A000152:SSL routines:final_renegotiate:unsafe legacy renegotiation disabled:../deps/openssl/openssl/ssl/statem/extensions.c:908
Run Code Online (Sandbox Code Playgroud)
根据我在这里发现的内容,可以创建一个自定义 OpenSSL 配置文件,允许不安全的旧版重新协商。并且使用 Node 的--openssl-config标志,应该可以“忽略”重新协商。我尝试编写第一个链接中编写的自定义配置文件并将其传递进去,但没有成功。
这个问题之前已经被问过,尽管恢复到旧版本的 Node 并不理想。
还有什么其他的 wasys 可以解决这个问题?
小智 25
正如您已经发现的,此错误来自 CVE-2009-3555,这是 IIS 问题,因此使用节点标志甚至不会忽略它。从节点 17 或 18 开始,他们删除了 OpenSSL 选项以接受旧服务器。
我认为针对您的情况,更好的解决方案是将 httpsAgent 与选项一起传递。根据自述文件,soap.js 从v0.40.0开始使用 Axios,因此您应该像这样设置请求参数:
const crypto = require('crypto')
const options = {
request: axios.create({
// axios options
httpsAgent: new https.Agent({
// for self signed you could also add
// rejectUnauthorized: false,
// allow legacy server
secureOptions: crypto.constants.SSL_OP_LEGACY_SERVER_CONNECT,
}),
}),
}
Run Code Online (Sandbox Code Playgroud)
https.Agent 的 secureOptions 是选项的数字位掩码SSL_OP_*
。
呂學洲*_*呂學洲 10
您还可以在执行节点进程时设置 OpenSSL 的全局配置:
node --openssl-config=/openssl.cnf
Run Code Online (Sandbox Code Playgroud)
--openssl-config
:启动时加载 OpenSSL 配置文件。
哪里openssl.cnf
可以像:
nodejs_conf = openssl_init
[openssl_init]
ssl_conf = ssl_sect
[ssl_sect]
system_default = system_default_sect
[system_default_sect]
Options = UnsafeLegacyRenegotiation
Run Code Online (Sandbox Code Playgroud)
使用nodejs_conf
是必需的,因为它可以避免与其他配置文件冲突,请参阅 参考资料--openssl-shared-config
获取更多信息。
...建议使用特定于 Node.js 的配置部分,即 nodejs_conf,并且在不使用此选项时是默认的。
归档时间: |
|
查看次数: |
29331 次 |
最近记录: |