php – Roundcube&Postfix SMTP:SSL例程:SSL3_READ_BYTES
我有个人使用的Postfix / Dovecot / Roundcube设置,以及提供给其他用户.我试图将整个设置转移到一个新的盒子,但有一些问题.
邮件接收工作正常,(仅在内部测试,域尚未传输.)以及外部IMAP& SMTP使用TLS / SSL工作很棒(例如Thunderbird) 问题在于我的圆形立方体设置,它可以使用IMAP到127.0.0.1,并且显示用户的电子邮件,但无法发送电子邮件,只是声称:“SMTP错误(220):身份验证失败.” 奇怪的是,使用我在当前服务器上使用的相同Postfix / Dovecot配置,Roundcube无法再在我的新服务器上访问它.这是相关的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'; 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) 而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 以下是/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 以下是/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 后缀日志/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] 我已经阅读了一些其他类似错误代码的问题,但它们似乎都使用了自签名证书,或者我已经尝试过的adding a link to the certificate’s hash from /etc/ssl/certs/,尽管我可能错过了解,并且链接了错误的证书. Roundcube更新到1.0.4,这应该解决由于openssl导致php版本不兼容的问题.我完全没有想法,任何人都有任何想法?
上面的错误消息看起来像客户端(圆形立方体调用的PHP脚本)
fails to verify peer certificate because unknown CA.发生此错误的原因有很多.
关于openssl,Roundcube版本1.0-RC和更高版本附带SSL连接选项.参数smtp_conn_options和imap_conn_options分别在版本1.0-RC和1.0.3中添加.默认情况下,两个参数的值均为null.下面的代码段取自roundcube文件config / defaults.inc.php.您可以参考PHP manual以获得此参数的完整描述. // 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; 在许多使用自签名证书的系统中,默认值适用于PHP 5.5及更早版本.默认情况下,PHP 5.6 will verify peer certificate against installed CA and verify the peer name. 现在,看起来像Debian jessie也是shipped with default PHP version 5.6.显然PHP无法验证postfix证书.可能的原因,PHP在verify_peer_name中失败(因为您在hostname中指定了localhost)或者在verify_peer中失败了(因为CA未知) 类似的情况也发生在to Arch Linux user.解决方案是: >在openssl cert目录中安装CA证书>在roundcube smtp_server选项中,将localhost更改为Postfix FQDN(来自OP的解决方案)>在smtp_conn_options中禁用verify_peer和/或verify_peer_name (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |