node.js - 强制 nodemailer 仅使用推荐的密码执行 TLS 1.2

标签 node.js tls1.2 nodemailer

我想让我的 NodeMailer 只能发送给运行 TLS 1.2 的收件人 - 并且只有当前推荐的密码 - 我将提供列表。

我已经查看了当前的选项,似乎我无法直接在 Transport 上提供此选项?或者如果可能的话如何?

我已阅读当前文档 - 它引用了 TLS 套接字对象,但我看不到任何“require”tls 选项?

最佳答案

您可以指定要使用的 TLS 选项,然后创建传输(请参阅此处的文档:https://nodemailer.com/smtp/)。

TLS Options允许您指定要使用的 TLS 协议(protocol)的最大和最小版本以及要使用的密码。

将最低 TLS 版本设置为 1.2 将至少强制执行此版本。

示例如下:

const nodemailer = require('nodemailer');

const transport = nodemailer.createTransport({
    host: "some-host",
    port: 465, // Use whichever port here.
    secure: true, // use TLS
    tls: {
        maxVersion: 'TLSv1.3',
        minVersion: 'TLSv1.2',
        ciphers: 'TLS_AES_128_GCM_SHA256',
    }
});

请参阅此处的链接以了解可能的密码套件:Node.js TLS Cipher suites

关于node.js - 强制 nodemailer 仅使用推荐的密码执行 TLS 1.2,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58814876/

相关文章:

node.js - 如何在笔记本电脑服务器上设置 Ghost 博客框架

ssl - 我想用JMeter模拟TLS握手过程

javascript - 使用nodemailer发送电子邮件

node.js - 尝试使用 docker-compose 和 nodemailer 设置本地 docker-mailserver

node.js - Webmatrix 2 损坏

javascript - 如何在 node.js 中异步执行多个 REST API 请求?

javascript - unique 在 mongoose 中做什么

go - 如何将 Base64 编码的 p12 转换为 tls.Certificate

c# - TLS 1.2 - 警报级别 - 致命 - 描述协议(protocol)版本

javascript - Session.send() 不起作用 : "session is not defined"