如何禁用 tls 1.0 并使用 nodejs 仅使用 tls 1.1 [英] How to disable tls 1.0 and use only tls 1.1 using nodejs

查看:97
本文介绍了如何禁用 tls 1.0 并使用 nodejs 仅使用 tls 1.1的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想禁用 TLS v1.0 并仅使用 TLS 1.1 及更高版本.

I want to disable the TLS v1.0 and use TLS 1.1 and above only.

通过nodejs,我使用的是https模块,如何设置https选项?

By nodejs, I use the https module, how to set the https options?

我已经阅读了 api 文档 node api tls,但我仍然不知道如何设置这个.

I have read the api doc node api tls, but I still don't know how to set this.

我认为这取决于 secureProtocolcipher,但我只是不知道如何设置该值.

I think it depends on the secureProtocol and cipher, but I just don't know how to set the value.

我的node版本是0.10.36,openssl版本是0.9.8j.

My node version is 0.10.36, and openssl version is 0.9.8j.

推荐答案

Marco 的解决方案对我有用,但由于 TLS 1.1 也被认为是一个漏洞,因此最好禁用两者并使用 TLS 1.2

Marco's solution worked for me, but as TLS 1.1 is also considered a vulnerability, it is better to disable both and go with TLS 1.2

const { constants } = require('crypto')
https.createServer({
    secureOptions: constants.SSL_OP_NO_TLSv1 | constants.SSL_OP_NO_TLSv1_1
    pfx: fs.readFileSync(path.resolve(pathToCert))
}, app).listen(443)

这篇关于如何禁用 tls 1.0 并使用 nodejs 仅使用 tls 1.1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆