简体   繁体   English

使用 Node 12 时强制使用 TLS1.2

[英]Force TLS1.2 while using Node 12

We are using NodeJS server with Node Version 12. Our server also makes request to other servers to get some data.我们正在使用 Node 版本 12 的 NodeJS 服务器。我们的服务器还向其他服务器发出请求以获取一些数据。 Out of the box Node is using TLS 1.3 for making these requests to other server.开箱即用的 Node 使用 TLS 1.3 向其他服务器发出这些请求。

Can we force NodeJS to use TLS1.2 instead of 1.3?!我们可以强制 NodeJS 使用 TLS1.2 而不是 1.3 吗?!

I have seen the tips to configure NodeJS http server to use TLS1.2 but how to configure my overall Node application to use TLS1.2 for sending requests?我已经看到将 NodeJS http 服务器配置为使用 TLS1.2 的提示,但是如何配置我的整个 Node 应用程序以使用 TLS1.2 发送请求?

There are ways of doing this for specific http / https clients.对于特定的 http / https 客户端,有一些方法可以做到这一点。 To do this globally is a little more tricky.在全球范围内做到这一点有点棘手。

There is a command line option for node.js, documented here: node.js 有一个命令行选项,记录在这里:

https://nodejs.org/api/tls.html#tls_tls_default_max_version https://nodejs.org/api/tls.html#tls_tls_default_max_version

Essentially you would invoke node.js like so:本质上你会像这样调用 node.js:

node --tls-max-v1.2 .\script.js

I'm not sure this will work, but it might be worth a try!我不确定这是否有效,但值得一试!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM