来自服务器的用户未与smtp.gmail.com通信

2022-04-03 00:00:00 python smtp ssl openssl cpanel

问题描述

我有一台安装了Bluehost的专用服务器,我在其中运行了几个脚本和项目(特别是Python)。其中一个由通过smtp.gmail.com端口465发送的基本电子邮件发件人组成,但它随机停止工作。在不断挖掘之后,我意识到该服务器中的用户没有成功地与smtp.gmail.com通信。但事实证明,它也没有与smtp.live.com或imap.gmail.com通信,所以我猜那里出了问题。

当我执行以下命令时:openssl s_client-crlf-Connect smtp.gmail.com:465 thorugh sudo(或直接从超级用户),在服务器中输出如下:

CONNECTED(00000003)
depth=2 C = US, O = Google Trust Services LLC, CN = GTS Root R1
verify return:1
depth=1 C = US, O = Google Trust Services LLC, CN = GTS CA 1C3
verify return:1
depth=0 CN = imap.gmail.com
verify return:1
---
Certificate chain
 0 s:CN = imap.gmail.com
   i:C = US, O = Google Trust Services LLC, CN = GTS CA 1C3
 1 s:C = US, O = Google Trust Services LLC, CN = GTS CA 1C3
   i:C = US, O = Google Trust Services LLC, CN = GTS Root R1
 2 s:C = US, O = Google Trust Services LLC, CN = GTS Root R1
   i:C = BE, O = GlobalSign nv-sa, OU = Root CA, CN = GlobalSign Root CA
---
Server certificate
-----BEGIN CERTIFICATE-----
blablablabla
.
.
.
blablablabla
-----END CERTIFICATE-----
subject=CN = imap.gmail.com
.
.
.
etc

和我的用户:

CONNECTED(00000003)
depth=3 C = GB, ST = Greater Manchester, L = Salford, O = Comodo CA Limited, CN = AAA Certifi        cate Services
verify return:1
depth=2 C = GB, ST = Greater Manchester, L = Salford, O = COMODO CA Limited, CN = COMODO RSA         Certification Authority
verify return:1
depth=1 C = US, ST = TX, L = Houston, O = "cPanel, Inc.", CN = "cPanel, Inc. Certification Au        thority"
verify return:1
depth=0 CN = [My server name!!!!! WHY?????]
verify return:1
---
Certificate chain
 0 s:/CN=[my server name]
   i:/C=US/ST=TX/L=Houston/O=cPanel, Inc./CN=cPanel, Inc. Certification Authority
 1 s:/C=US/ST=TX/L=Houston/O=cPanel, Inc./CN=cPanel, Inc. Certification Authority
   i:/C=GB/ST=Greater Manchester/L=Salford/O=COMODO CA Limited/CN=COMODO RSA Certification Au        thority
 2 s:/C=GB/ST=Greater Manchester/L=Salford/O=COMODO CA Limited/CN=COMODO RSA Certification Au        thority
   i:/C=GB/ST=Greater Manchester/L=Salford/O=Comodo CA Limited/CN=AAA Certificate Services
---
Server certificate
-----BEGIN CERTIFICATE-----
blablablabla
    .
    .
    .
blablablabla
-----END CERTIFICATE-----
subject=CN = [My server again] 
    .
    .
    .
    etc

imap.gmail.com、smtp.live.com和我猜等等都会发生同样的情况。我的服务器似乎是在与自己通信,而不是外部服务器。 通过端口443对网站进行的其他OpenSSL查询运行得很好,还有一件重要的事情,当我执行Telnet smtp.gmail.com 25时,它也连接到我自己的服务器,而不是sudo/根用户,在那里它工作得很好。

我能用SSL或类似的东西弄坏一些东西吗?

谢谢!


解决方案

最好的解决方案是联系Bluehost,在扩展到他们的高级团队后,他们得到了解决方案:

Hello,

Thank you for your response, explaining the issue you are experiencing further.

There is a setting in the WHM that only allows outbound SMTP connections from root, exim and mailman.  I set that to off so you will now be able to connect via SMTP as the cPanel user and not just as root.

相关文章