我使用的是 Debian 7,带有 postfix/courier。当我尝试使用 SMTP 登录时,出现以下错误
telnet localhost 25
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
220 mail.mydomain.com ESMTP Postfix (Debian/GNU)
ehlo localhost
250-mail.mydomain.com
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-STARTTLS
250-AUTH PLAIN LOGIN
250-AUTH=PLAIN LOGIN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
AUTH LOGIN
334 VXNlcm5hbWU6
dGVzdEB0ZXN0LmNvbQ==
334 UGFzc3dvcmQ6
dGVzdA==
535 5.7.8 Error: authentication failed: no mechanism available
我已经在 Google 上搜索了几个小时试图修复这个问题 :( 我有另一台以完全相同的方式安装的服务器,也是在 Debian 7 上运行良好的。
以下是 saslfinger 的输出:
saslfinger -s
saslfinger - postfix Cyrus sasl configuration Thu Mar 12 18:07:21 EDT 2015
version: 1.0.4
mode: server-side SMTP AUTH
-- basics --
Postfix: 2.9.6
System: Debian GNU/Linux 7 \n \l
-- smtpd is linked to --
libsasl2.so.2 => /usr/lib/x86_64-linux-gnu/libsasl2.so.2 (0x00007fd3d5d62000)
-- active SMTP AUTH and TLS parameters for smtpd --
broken_sasl_auth_clients = yes
smtpd_sasl_auth_enable = yes
smtpd_sasl_authenticated_header = yes
smtpd_sasl_path = smtpd
smtpd_sasl_security_options = noanonymous
smtpd_sasl_type = cyrus
smtpd_tls_cert_file = /etc/postfix/smtpd.cert
smtpd_tls_key_file = /etc/postfix/smtpd.key
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtpd_use_tls = yes
-- listing of /usr/lib/sasl2 --
total 24
drwxr-xr-x 2 root root 4096 Mar 5 08:27 .
drwxr-xr-x 44 root root 12288 Mar 12 17:22 ..
-rw-r--r-- 1 root root 4 Mar 5 08:27 berkeley_db.active
-rw-r--r-- 1 root root 4 Jun 9 2013 berkeley_db.txt
-- listing of /etc/postfix/sasl --
total 12
drwxr-xr-x 2 root root 4096 Mar 5 10:04 .
drwxr-xr-x 3 root root 4096 Mar 12 17:22 ..
-rw-r--r-- 1 root root 295 Mar 12 17:36 smtpd.conf
-- content of /etc/postfix/sasl/smtpd.conf --
pwcheck_method: saslauthd
mech_list: plain login
allow_plaintext: true
auxprop_plugin: mysql
sql_hostnames: 127.0.0.1
sql_user: --- replaced ---
sql_passwd: --- replaced ---
sql_database: mail
sql_select: select password from users where email = '%u'
saslauthd_path: /var/spool/postfix/var/run/saslauthd/mux
-- content of /etc/postfix/sasl/smtpd.conf --
pwcheck_method: saslauthd
mech_list: plain login
allow_plaintext: true
auxprop_plugin: mysql
sql_hostnames: 127.0.0.1
sql_user: --- replaced ---
sql_passwd: --- replaced ---
sql_database: mail
sql_select: select password from users where email = '%u'
saslauthd_path: /var/spool/postfix/var/run/saslauthd/mux
-- active services in /etc/postfix/master.cf --
# service type private unpriv chroot wakeup maxproc command + args
# (yes) (yes) (yes) (never) (100)
smtp inet n - - - - smtpd
smtps inet n - - - - smtpd
pickup fifo n - - 60 1 pickup
cleanup unix n - - - 0 cleanup
qmgr fifo n - n 300 1 qmgr
tlsmgr unix - - - 1000? 1 tlsmgr
rewrite unix - - - - - trivial-rewrite
bounce unix - - - - 0 bounce
defer unix - - - - 0 bounce
trace unix - - - - 0 bounce
verify unix - - - - 1 verify
flush unix n - - 1000? 0 flush
proxymap unix - - n - - proxymap
proxywrite unix - - n - 1 proxymap
smtp unix - - - - - smtp
relay unix - - - - - smtp
showq unix n - - - - showq
error unix - - - - - error
retry unix - - - - - error
discard unix - - - - - discard
local unix - n n - - local
virtual unix - n n - - virtual
lmtp unix - - - - - lmtp
anvil unix - - - - 1 anvil
scache unix - - - - 1 scache
maildrop unix - n n - - pipe
flags=DRhu user=vmail argv=/usr/bin/maildrop -d ${recipient}
uucp unix - n n - - pipe
flags=Fqhu user=uucp argv=uux -r -n -z -a$sender - $nexthop!rmail ($recipient)
ifmail unix - n n - - pipe
flags=F user=ftn argv=/usr/lib/ifmail/ifmail -r $nexthop ($recipient)
bsmtp unix - n n - - pipe
flags=Fq. user=bsmtp argv=/usr/lib/bsmtp/bsmtp -t$nexthop -f$sender $recipient
scalemail-backend unix - n n - 2 pipe
flags=R user=scalemail argv=/usr/lib/scalemail/bin/scalemail-store ${nexthop} ${user} ${extension}
mailman unix - n n - - pipe
flags=FR user=list argv=/usr/lib/mailman/bin/postfix-to-mailman.py
${nexthop} ${user}
-- mechanisms on localhost --
250-AUTH PLAIN LOGIN
250-AUTH=PLAIN LOGIN
写入的所有内容/var/log/mail.log
是
Mar 12 18:36:38 myhostname postfix/smtpd[4099]: connect from localhost[127.0.0.1]
Mar 12 18:37:14 myhostname postfix/smtpd[4099]: warning: localhost[127.0.0.1]: SASL LOGIN authentication failed: no mechanism available
最后
testsaslauthd -u [email protected] -p test -f /var/spool/postfix/var/run/saslauthd/mux -s smtp
0: OK "Success."
我不知道是什么原因导致了这种情况的发生,从我读到的内容来看,这似乎与 postfix 的 chrooting 有关,但我没有发现配置中有任何问题。
答案1
auxprop_plugin: mysql
我已经通过将 更改为 来修复此问题auxprop_plugin: sql
,我不明白为什么在同一版本的 debian 上会有所不同,但现在它可以正常工作。