[英]IMAP via PHP: /ssl and /tls choose different TLS version
I'm using z-push-contrib to get emails from an IMAP server (run by me as well). 我正在使用z-push-contrib从IMAP服务器获取电子邮件(也由我运行)。
If I use the imap_open
option /ssl
and connect to port 993, TLS 1.2 is being used. 如果我使用
imap_open
选项/ssl
并连接到端口993,则正在使用TLS 1.2。
If I use /tls
and connect to port 143 using STARTTLS, TLS 1.0 and a different cipher is being used. 如果我使用
/tls
并使用STARTTLS连接到端口143,则将使用TLS 1.0和其他密码。
SMTP behaves the same (STARTTLS only uses TLS 1.0) SMTP的行为相同(STARTTLS仅使用TLS 1.0)
If I use openssl from the command line, TLS 1.2 is being used: 如果我从命令行使用openssl,则使用TLS 1.2:
It doesn't matter if I connect to port 993 or to 143 with STARTTLS, I always get a TLS 1.2 connection using the same strong, modern cipher. 无论是通过STARTTLS连接到端口993还是连接到143,都无所谓,我总是使用相同的现代强密码获得TLS 1.2连接。
Is this a bug in PHP's Openssl implementation? 这是PHP的Openssl实施中的错误吗?
No, it's defined at the PHP documentation : 不,它在PHP文档中定义:
The difference is very subtle. 区别非常细微。 Basically StatTLS connects to an unencrypted port/connection and then asks for encryption, while TLS/SSL sessions are encrypted before any text is transmitted (see STARTTLS ).
基本上,StatTLS连接到未加密的端口/连接,然后请求加密,而TLS / SSL会话在传输任何文本之前已加密(请参阅STARTTLS )。 They usually use different ports, but it's common for mail servers to support both on both ports (so they support a broader range of clients).
它们通常使用不同的端口,但是邮件服务器在两个端口上同时支持这两个端口是很常见的(因此它们支持更广泛的客户端)。
Cipher and TLS version choice is based on client-server negotiation, but STARTTLS could be understood as a less-capable client or server, then the parameters for decision differ. 密码和TLS版本的选择是基于客户端-服务器协商的,但是STARTTLS可以理解为功能较弱的客户端或服务器,因此决策的参数有所不同。
AFAIK, there's no limitation on the usage of TLS1.1 and TLS1.2 when connecting through STARTTLS, but they do connect differently than TLS/SSL. AFAIK,通过STARTTLS连接时,对TLS1.1和TLS1.2的使用没有限制,但它们的连接方式与TLS / SSL不同。
In doubt, use TLS/SSL, since it's more secure :) 有疑问,请使用TLS / SSL,因为它更安全:)
Update 更新
PHP IMAP extension makes use of c-Client library for IMAP protocol-specific functions. PHP IMAP扩展将c-Client库用于IMAP协议特定的功能。 This library is somewhat outdated (2007) — and probably handles STARTTLS commands differently than calling openssl — that's why the difference in encryption/ciphers used.
该库(2007)有点过时了-处理STARTTLS命令的方式可能不同于调用openssl的方式-这就是为什么使用的加密/密码不同的原因。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.