简体   繁体   English

IMAP开放流:自签名证书问题

[英]IMAP open stream: Self signed certificate issue

I'm trying to open the non-secure (port 143) IMAP connection (I am using PHP): 我正在尝试打开非安全(端口143)IMAP连接(我正在使用PHP):

imap_open('{localhost:143/imap}INBOX', USERNAME, PASS);

and I get the next error: Certificate failure for localhost: self signed certificate ... 我收到下一个错误: Certificate failure for localhost: self signed certificate ...

Ok. 好。 I've tried to use /novalidate-cert mailbox param. 我试过使用/novalidate-cert邮箱参数。 Then I get another error: Can not authenticate to IMAP server . 然后我得到另一个错误: Can not authenticate to IMAP server

I've also tried to combine all possible non-secure connection params like /notls , /norsh and /secure . 我还试图结合所有可能的非安全连接参数,如/notls/norsh/secure But I always get errors. 但我总是得到错误。

This is the Dovecot configuration I'm using: 这是我正在使用的Dovecot配置:

* OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE IDLE STARTTLS AUTH=LOGIN] Dovecot ready.

The certificate is really self-signed and generated with openssl. 证书实际上是自签名的,并使用openssl生成。

The questions are: 问题是:

  1. Why does the certificate error occurs when I am using non-secure connection? 为什么在使用非安全连接时会出现证书错误?
  2. What is wrong with the mail server configuration? 邮件服务器配置有什么问题?

STARTTLS of course uses the certificate to start the TLS channel, hence why you saw a self-signed cert error. STARTTLS当然使用证书来启动TLS通道,因此您看到了自签名证书错误的原因。 Can not authenticate , however, implies your username and password are wrong. 但是, Can not authenticate意味着您的用户名和密码错误。 Try logging in using telnet to verify your user and password are correct 尝试使用telnet登录以验证您的用户和密码是否正确

Use this code 使用此代码

   imap_open('{localhost:143/imap/novalidate-cert/debug}INBOX', USERNAME, PASS);

Instead of this 而不是这个

    imap_open('{localhost:143/imap}INBOX', USERNAME, PASS); 

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

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