简体   繁体   English

Node-RED和nodemailer - 错误:无法验证第一个证书

[英]Node-RED and nodemailer - Error: unable to verify the first certificate

I am trying to make something very basic work and it just isn't working for me. 我正在尝试做一些非常基本的工作而且它对我不起作用。 I have a simple Node-RED flow with an inject input node and an email output node: 我有一个简单的Node-RED流,带有一个注入输入节点和一个电子邮件输出节点:

注入电子邮件节点

The properties of the email node look like this: 电子邮件节点的属性如下所示:

电子邮件配置窗口

The error says: 错误说:

"7/28/2017, 11:43:28 AM node: fname.lname@company.com msg : error "Error: unable to verify the first certificate" “7月28日上午11:43:28节点:fname.lname@company.com消息:错误”错误:无法验证第一个证书“

I am able to manually send unauthenticated email through this server via telnet. 我可以通过telnet手动通过此服务器发送未经身份验证的电子邮件。 Even if I enter account creds it gives me the same "Error: unable to verify the first certificate". 即使我输入帐户信用卡,它也会给我相同的“错误:无法验证第一个证书”。

Am I missing something simple? 我错过了一些简单的事吗?

I don't have enough reputation to write a comment, but i am adding this line for the previous reply, somebody might need it, 我没有足够的声誉来撰写评论,但我为前一个回复添加了这一行,有人可能需要它,

to bypass this error in Node.js program, type: 要在Node.js程序中绕过此错误,请键入:

process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0";

The problem is that the mail server you are connecting to is using SSL and the certificate it is supplying is not signed by one of the trusted CA's built into the Node.JS implementation you are using. 问题是您要连接的邮件服务器正在使用SSL,并且它提供的证书未由您正在使用的Node.JS实现中内置的可信CA之一签名。

I'm guessing it's a self signed certificate. 我猜这是一张自签名证书。

The Error says that Node.JS can not verify the first certificate in the presented chain. Error表示Node.JS无法验证所呈现链中的第一个证书。

My best guess is that Nodemailer (which is used under the covers by the email node) is seeing the STARTTLS option listed when it sends the EHLO command as it starts the connection to the mail server and is trying to upgrade the connection to one that is secure. 我最好的猜测是,Nodemailer(在电子邮件节点的封面下使用)在发送EHLO命令时会看到列出的STARTTLS选项,因为它启动了与邮件服务器的连接,并尝试将连接升级为安全。

While I really wouldn't normally recommend this, you can turn off Node.JS's cert checking by exporting the following environment variable before starting Node-RED: 虽然我真的不建议这样做,但您可以在启动Node-RED之前通过导出以下环境变量来关闭Node.JS的证书检查:

NODE_TLS_REJECT_UNAUTHORIZED=0

This turns off ALL certificate checking, so you are open to man in the middle attacks for any TLS/SSL connection made from Node-RED. 这将关闭所有证书检查,因此您可以在中间攻击中对由Node-RED进行的任何TLS / SSL连接开放。

The real solution here is to get a proper certificate for the mail server, maybe something from the letsencrypt project especially if this mail server is internet facing in any way. 这里真正的解决方案是为邮件服务器获取一个合适的证书,也许来自letsencrypt项目,特别是如果这个邮件服务器以任何方式面向互联网。

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

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