我的系统是Debian 7 aka用Postfix,courier和mysql安装。 信使运作良好,如果我发出
testsaslauthd -u user@domain -p password -f /var/spool/postfix/var/run/saslauthd/mux -s smtp
我得到了
0: OK "Success."
但是,如果我得到一个base64编码的用户名/密码
echo -ne '\000user@domain\000password' | openssl base64
并尝试使用SMTP会话中使用
helo localhost auth plain (output from above)
我总是得到一个
535 5.7.8 Error: authentication failed: authentication failure
在/ var / log / syslog中我find了
Sep 29 21:49:34 (hostname obfuscated) postfix/smtpd[15814]: warning: SASL authentication failure: Password verification failed Sep 29 21:49:34 (hostname obfuscated) postfix/smtpd[15814]: warning: localhost[::1]: SASL plain authentication failed: authentication failure
和/var/log/auth.log
Sep 29 21:49:34 (hostname obfuscated) postfix/smtpd[15814]: sql plugin Parse the username username@domain Sep 29 21:49:34 (hostname obfuscated) postfix/smtpd[15814]: sql plugin try and connect to a host Sep 29 21:49:34 (hostname obfuscated) postfix/smtpd[15814]: sql plugin trying to open db 'postfixadmin' on host '127.0.0.1' Sep 29 21:49:34 (hostname obfuscated) postfix/smtpd[15814]: begin transaction Sep 29 21:49:34 (hostname obfuscated) postfix/smtpd[15814]: sql plugin create statement from userPassword username domain Sep 29 21:49:34 (hostname obfuscated) postfix/smtpd[15814]: sql plugin doing query SELECT password FROM mailbox WHERE username="username@domain"; Sep 29 21:49:34 (hostname obfuscated) postfix/smtpd[15814]: commit transaction Sep 29 21:49:34 (hostname obfuscated) postfix/smtpd[15814]: sql plugin Parse the username username@domain Sep 29 21:49:34 (hostname obfuscated) postfix/smtpd[15814]: sql plugin try and connect to a host Sep 29 21:49:34 (hostname obfuscated) postfix/smtpd[15814]: sql plugin trying to open db 'postfixadmin' on host '127.0.0.1' Sep 29 21:49:34 (hostname obfuscated) postfix/smtpd[15814]: sql plugin Parse the username username@domain Sep 29 21:49:34 (hostname obfuscated) postfix/smtpd[15814]: sql plugin try and connect to a host Sep 29 21:49:34 (hostname obfuscated) postfix/smtpd[15814]: sql plugin trying to open db 'postfixadmin' on host '127.0.0.1' Sep 29 21:49:34 (hostname obfuscated) postfix/smtpd[15814]: begin transaction Sep 29 21:49:34 (hostname obfuscated) postfix/smtpd[15814]: sql plugin create statement from userPassword username domain Sep 29 21:49:34 (hostname obfuscated) postfix/smtpd[15814]: sql plugin doing query SELECT password FROM mailbox WHERE username="username@domain"; Sep 29 21:49:34 (hostname obfuscated) postfix/smtpd[15814]: sql plugin create statement from cmusaslsecretPLAIN username domain Sep 29 21:49:34 (hostname obfuscated) postfix/smtpd[15814]: sql plugin doing query SELECT password FROM mailbox WHERE username="username@domain"; Sep 29 21:49:34 (hostname obfuscated) postfix/smtpd[15814]: commit transaction Sep 29 21:49:34 (hostname obfuscated) postfix/smtpd[15814]: sql plugin Parse the username username@domain Sep 29 21:49:34 (hostname obfuscated) postfix/smtpd[15814]: sql plugin try and connect to a host Sep 29 21:49:34 (hostname obfuscated) postfix/smtpd[15814]: sql plugin trying to open db 'postfixadmin' on host '127.0.0.1'
我的后缀configuration中的相关SASL条目:
# postconf | grep -e cyrus_sasl -e smtpd_sasl cyrus_sasl_config_path = send_cyrus_sasl_authzid = no smtpd_sasl_auth_enable = yes smtpd_sasl_authenticated_header = yes smtpd_sasl_exceptions_networks = smtpd_sasl_local_domain = $myhostname smtpd_sasl_path = smtpd smtpd_sasl_security_options = noanonymous smtpd_sasl_tls_security_options = $smtpd_sasl_security_options smtpd_sasl_type = cyrus
任何人都可以给我一个提示如何分析或debugging呢?
更新2014/10/01:经过越来越多的尝试,我发现这绝对是从MySQL数据库读取密码的问题。 我编辑/etc/postfix/sasl/smtpd.conf,并在我写的最后一行
sql_select: SELECT 'some hardcoded password' password FROM mailbox WHERE username="%u@%r"
现在它工作。 不过,这显然不是我打算做的。
第二次更新2014/10/01:有趣的…当smtpd.conf只包含
pwcheck_method: saslauthd mech_list: plain login
一切工作,因为它应该! 为我解决。
解决scheme:/etc/postfix/sasl/smtpd.conf只需包含
pwcheck_method: saslauthd mech_list: plain login
为我工作的解决scheme是改变
smtpd_sasl_type = cyrus
至
smtpd_sasl_type = dovecot
并确保安装了dovecot-imapd。