Meteor应用配置自签名证书邮件服务器发件失败求助
Meteor自托管邮件服务器证书信任问题排查
我最近在折腾让Meteor应用使用自己的邮件服务器发送邮件,已经按照以下步骤把邮件服务器的证书安装到了Meteor所在的服务器上:
openssl s_client -connect my-email-server.com:443 <<<'' | openssl x509 -out /tmp/mycert cp /tmp/mycert /usr/local/share/ca-certificates/ update-ca-certificates
同时我还通过dpkg-reconfigure ca-certificates完成了证书安装(参考编号90607)。
之后我尝试了两种方式启动Meteor应用,但都没办法成功发送邮件:
- 方式1:
MAIL_URL=smtp://user:password@my-email-server.com:587 meteor - 方式2:
CAFILE="/tmp/mycert" MAIL_URL=smtp://user:password@my-email-server.com:587 meteor
应用里发送邮件的代码是这样的:
Email.send({ to: emailAddress, from: "user@my-email-server.com", subject: "Example Email", text: "The contents of our email in plain text.", });
每次都会收到这样的错误信息:
I20180114-04:09:25.698(-5)? Exception while invoking method 'emailMethod' Error: unable to verify the first certificate I20180114-04:09:25.698(-5)? at TLSSocket.<anonymous> (_tls_wrap.js:1103:38) I20180114-04:09:25.698(-5)? at emitNone (events.js:106:13) I20180114-04:09:25.699(-5)? at TLSSocket.emit (events.js:208:7) I20180114-04:09:25.699(-5)? at TLSSocket._finishInit (_tls_wrap.js:637:8) I20180114-04:09:25.699(-5)? at TLSWrap.ssl.onhandshakedone (_tls_wrap.js:467:38) Exception while invoking method 'emailMethodHere' Error: unable to verify the first certificate
不过当我用NODE_TLS_REJECT_UNAUTHORIZED=0 MAIL_URL=smtp://user:password@my-email-server.com:587 meteor启动应用时,邮件就能正常发送了——这明显是绕过了证书验证,所以问题肯定出在证书信任上。
想请教下我的操作哪里存在错误?怎么才能让Meteor信任我通过上述openssl命令获取的证书?之前我已经参考过adding-a-self-signed-certificate-to-the-trusted-list、meteor add trusted certificate error: self signed certificate in certificate chain、ssl-root-cas相关的内容,但还是没解决问题。
内容的提问来源于stack exchange,提问作者zz3star90
相关产品推荐
相关产品推荐

