1n5*_*1aC 10 php smtp postfix openssl roundcube
我有一个 Postfix / Dovecot / Roundcube 设置,我个人使用,也提供给其他用户。我试图将整个设置转移到一个新的盒子,但有一些问题。
邮件接收工作正常(仅在内部测试,域尚未传输。)以及使用 TLS/SSL 的外部 IMAP 和 SMTP 工作正常(例如,Thunderbird)
问题出在我的圆形立方体设置上,它可以使用 IMAP 到 127.0.0.1,并且可以很好地显示用户的电子邮件,但无法发送电子邮件,只需声明: "SMTP Error (220): Authentication failed."
奇怪的是,使用我在当前服务器上使用的相同 Postfix/Dovecot 配置,Roundcube 无法再在我的新服务器上访问它。这是相关的圆形立方体配置:
$config['smtp_server'] = 'tls://localhost';
// Log SMTP conversation to <log_dir>/smtp or to syslog
$config['smtp_debug'] = true;
// SMTP port (default is 25; use 587 for STARTTLS or 465 for the
// deprecated SSL over SMTP (aka SMTPS))
$config['smtp_port'] = 587;
// SMTP username (if required) if you use %u as the username Roundcube
// will use the current username for login
$config['smtp_user'] = '%u';
// SMTP password (if required) if you use %p as the password Roundcube
// will use the current user's password for login
$config['smtp_pass'] = '%p';
Run Code Online (Sandbox Code Playgroud)
Roundcube 的日志/错误日志简单地说:
[02-Jan-2015 16:55:49 America/New_York] STARTTLS failed ():
[02-Jan-2015 16:55:49 -0500]: SMTP Error: SMTP error: Authentication failure: STARTTLS failed (Code: ) in /var/wwwmail/program/lib/Roundcube/rcube.php on line 1505 (POST /?_task=mail&_unlock=loading1420235752730&_lang=undefined&_framed=1?_task=mail&_action=send)
Run Code Online (Sandbox Code Playgroud)
Roundcube 的日志/smtp 日志显示:
[02-Jan-2015 17:50:01 -0500]: Recv: 220 example.net ESMTP Postfix
[02-Jan-2015 17:50:01 -0500]: Send: EHLO example.net
[02-Jan-2015 17:50:01 -0500]: Recv: 250-example.net
[02-Jan-2015 17:50:01 -0500]: Recv: 250-PIPELINING
[02-Jan-2015 17:50:01 -0500]: Recv: 250-SIZE 104857600
[02-Jan-2015 17:50:01 -0500]: Recv: 250-VRFY
[02-Jan-2015 17:50:01 -0500]: Recv: 250-ETRN
[02-Jan-2015 17:50:01 -0500]: Recv: 250-STARTTLS
[02-Jan-2015 17:50:01 -0500]: Recv: 250-ENHANCEDSTATUSCODES
[02-Jan-2015 17:50:01 -0500]: Recv: 250-8BITMIME
[02-Jan-2015 17:50:01 -0500]: Recv: 250 DSN
[02-Jan-2015 17:50:01 -0500]: Send: STARTTLS
[02-Jan-2015 17:50:01 -0500]: Recv: 220 2.0.0 Ready to start TLS
[02-Jan-2015 17:50:01 -0500]: Send: RSET
[02-Jan-2015 17:50:01 -0500]: Recv: M I A…"qhçR¸
[02-Jan-2015 17:50:01 -0500]: Send: QUIT
Run Code Online (Sandbox Code Playgroud)
以下是 /etc/postfix/main.cf 中我的 postfix 配置的相关片段
# TLS parameters for SMTP service
smtpd_tls_security_level = may
smtpd_tls_cert_file = /etc/ssl/private/example.net/example.net.crt
smtpd_tls_key_file = /etc/ssl/private/example.net/example.net.key
smtpd_tls_auth_only = yes
Run Code Online (Sandbox Code Playgroud)
以下是我来自 /etc/postfix/master.cf 的 postfix 配置的相关片段
smtp inet n - - - - smtpd
-o content_filter=spamassassin
submission inet n - n - - smtpd
-o syslog_name=postfix/submission
-o smtpd_tls_security_level=encrypt
-o smtpd_sasl_auth_enable=yes
-o cleanup_service_name=cleanup_submit
smtps inet n - - - - smtpd
-o content_filter=spamassassin
-o syslog_name=postfix/smtps
-o smtpd_tls_wrappermode=yes
-o smtpd_sasl_auth_enable=yes
-o smtpd_client_restrictions=permit_sasl_authenticated,reject
-o milter_macro_daemon_name=ORIGINATING
Run Code Online (Sandbox Code Playgroud)
Postfix日志/var/log/mail.log报如下错误:
Jan 2 17:50:01 example postfix/submission/smtpd[19959]: connect from localhost.localdomain[127.0.0.1]
Jan 2 17:50:01 example postfix/submission/smtpd[19959]: SSL_accept error from localhost.localdomain[127.0.0.1]: 0
Jan 2 17:50:01 example postfix/submission/smtpd[19959]: warning: TLS library problem: error:14094418:SSL routines:SSL3_READ_BYTES:tlsv1 alert unknown ca:s3_pkt.c:1292:SSL alert number 48:
Jan 2 17:50:01 example postfix/submission/smtpd[19959]: lost connection after STARTTLS from localhost.localdomain[127.0.0.1]
Jan 2 17:50:01 example postfix/submission/smtpd[19959]: disconnect from localhost.localdomain[127.0.0.1]
Run Code Online (Sandbox Code Playgroud)
我已经阅读了一些带有类似错误代码的其他问题,但它们似乎都在使用自签名证书,或者从 /etc/ssl/certs/ 添加到证书哈希的链接,我已经尝试过,尽管我可能误会了,并链接了错误的证书。
Roundcube 更新到 1.0.4,本该修复由于 openssl 导致 php 版本不兼容的问题。我完全没有想法,有人有任何想法吗?
mas*_*oeh 11
上面看起来像一个客户端错误消息(PHP脚本调用由roundcube)无法验证对方的证书,因为CA不明。发生此错误的原因有很多。
关于 openssl,Roundcube 版本 1.0-RC 及更高版本附带 SSL 连接选项。参数smtp_conn_options和imap_conn_options分别在 1.0-RC 和 1.0.3 版本中添加。默认情况下,两个参数的值都为空。下面的片段取自 roundcube 文件config/defaults.inc.php。您可以参考PHP 手册来获得该参数的完整描述。
// SMTP socket context options
// See http://php.net/manual/en/context.ssl.php
// The example below enables server certificate validation, and
// requires 'smtp_timeout' to be non zero.
// $config['smtp_conn_options'] = array(
// 'ssl' => array(
// 'verify_peer' => true,
// 'verify_depth' => 3,
// 'cafile' => '/etc/openssl/certs/ca.crt',
// ),
// );
$config['smtp_conn_options'] = null;
Run Code Online (Sandbox Code Playgroud)
在许多使用自签名证书的系统中,默认值适用于 PHP 5.5 及更早版本。默认情况下,PHP 5.6 将根据已安装的 CA 验证对等证书并验证对等名称。
现在,看起来 Debian jessie 也附带了默认的 PHP 版本 5.6。显然 PHP 无法验证后缀证书。可能的原因,PHP在verify_peer_name(因为你在主机名中指定了localhost)或verify_peer(因为CA未知)失败了
类似的情况也发生在 Arch Linux 用户身上。解决方案是:
| 归档时间: |
|
| 查看次数: |
38467 次 |
| 最近记录: |