求教postfix smtp验证失败的解决办法

系统安装、升级讨论
版面规则
我们都知道新人的确很菜,也喜欢抱怨,并且带有浓厚的Windows习惯,但既然在这里询问,我们就应该有责任帮助他们解决问题,而不是直接泼冷水、简单的否定或发表对解决问题没有任何帮助的帖子。乐于分享,以人为本,这正是Ubuntu的精神所在。
回复
头像
link_01
帖子: 1024
注册时间: 2008-11-05 13:24

求教postfix smtp验证失败的解决办法

#1

帖子 link_01 » 2009-09-08 11:10

按照wiki里的方法,安装了postfix和courier、sasl,mysql
telnet测试110可以通过,客户端验证也没问题,
但是smtp验证就是过不了,一下telnet的结果

希望有人能够赐教。

代码: 全选

link0x@link0x-ubuntu:~$ telnet ××××× 25
Trying ×××××...
Connected to ××××××.
Escape character is '^]'.
220 ××××××× ESMTP Postfix (Ubuntu)
ehlo ×××t.com
250-mail.××××t.com
250-PIPELINING
250-SIZE 15728640
250-VRFY
250-ETRN
250-STARTTLS
250-AUTH LOGIN
250-AUTH=LOGIN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
auth login
334 VXNlcm5hbWU6
bWFpbEBkaWFuc29mdC5jb20=
334 UGFzc3dvcmQ6
dzEyMzEyMzA=
535 5.7.8 Error: authentication failed: authentication failure
postfix的main.cf

代码: 全选

# See /usr/share/postfix/main.cf.dist for a commented, more complete version


# Debian specific:  Specifying a file name will cause the first
# line of that file to be used as the name.  The Debian default
# is /etc/mailname.
#myorigin = /etc/mailname

smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
biff = no

# appending .domain is the MUA's job.
append_dot_mydomain = no

# Uncomment the next line to generate "delayed mail" warnings
#delay_warning_time = 4h

readme_directory = no

# TLS parameters
smtpd_tls_cert_file=/etc/apache2/ssl/server.pem
smtpd_tls_key_file=/etc/apache2/ssl/server.pem
smtpd_tls_CAfile = /etc/apache2/ssl/server.pem
smtpd_tls_auth_only = no
smtpd_use_tls=yes
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache

# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
# information on enabling SSL in the smtp client.

myhostname = ×××××××*.com
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = ******.com
mydestination =
relayhost =
#mynetworks = all
mynetworks = 127.0.0.0/8
#[::ffff:127.0.0.0]/104 [::1]/128
message_size_limit = 15728640
recipient_delimiter = +
inet_interfaces = all
inet_protocols = all

home_mailbox = Maildir/

#virtual mailbox domain settings 
virtual_alias_maps = mysql:/etc/postfix/mysql_virtual_alias_maps.cf
virtual_mailbox_domains = mysql:/etc/postfix/mysql_virtual_domains_maps.cf
virtual_mailbox_maps = mysql:/etc/postfix/mysql_virtual_mailbox_maps.cf
virtual_minimum_uid = 5000
virtual_uid_maps = static:5000
virtual_gid_maps = static:5000
virtual_mailbox_base = /home/vmail
virtual_transport = virtual

#additional for quota support

virtual_create_maildirsize = yes
virtual_mailbox_extended = yes
virtual_mailbox_limit_maps = mysql:/etc/postfix/mysql_virtual_mailbox_limit_maps.cf
virtual_mailbox_limit_override = yes
virtual_maildir_limit_message =
    Sorry, the your maildir has overdrawn your diskspace quota,
    please free up some of spaces of your mailbox try again.
virtual_overquota_bounce = yes

smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
smtpd_sasl_local_domain = $myhostname
smtpd_sasl_authenticated_header = yes
smtpd_sasl_path = smtpd
#/etc/postfix/sasl:/usr/lib/sasl2
broken_sasl_auth_clients = yes
smtpd_recipient_restrictions = permit_sasl_authenticated,permit_mynetworks,permit_auth_destination,reject
改来改去最后的配置时这样的了,/etc/postfix/sasl/smtpd.conf

代码: 全选

pwcheck_method:auxprop
auxprop_plugin:sql
mech_list:PLAN LOGIN
sql_engine:mysql
sql_hostnames:127.0.0.1
sql_user:postfix
sql_password:postfixpassword
sql_select:select password from mailbox where username='%u@%r' and active = 1
/etc/default/saslauthd

代码: 全选

#
# Settings for saslauthd daemon
# Please read /usr/share/doc/sasl2-bin/README.Debian for details.
#

# Should saslauthd run automatically on startup? (default: no)
START=yes

# Description of this saslauthd instance. Recommended.
# (suggestion: SASL Authentication Daemon)
DESC="SASL Authentication Daemon"

# Short name of this saslauthd instance. Strongly recommended.
# (suggestion: saslauthd)
NAME="saslauthd"

# Which authentication mechanisms should saslauthd use? (default: pam)
#
# Available options in this Debian package:
# getpwent  -- use the getpwent() library function
# kerberos5 -- use Kerberos 5
# pam       -- use PAM
# rimap     -- use a remote IMAP server
# shadow    -- use the local shadow password file
# sasldb    -- use the local sasldb database file
# ldap      -- use LDAP (configuration is in /etc/saslauthd.conf)
#
# Only one option may be used at a time. See the saslauthd man page
# for more information.
#
# Example: MECHANISMS="pam"
MECHANISMS="pam"

# Additional options for this mechanism. (default: none)
# See the saslauthd man page for information about mech-specific options.
MECH_OPTIONS=""

# How many saslauthd processes should we run? (default: 5)
# A value of 0 will fork a new process for each connection.
THREADS=5

# Other options (default: -c -m /var/run/saslauthd)
# Note: You MUST specify the -m option or saslauthd won't run!
#
# See /usr/share/doc/sasl2-bin/README.Debian for Debian-specific information.
# See the saslauthd man page for general information about these options.
#
# Example for postfix users: "-c -m /var/spool/postfix/var/run/saslauthd"
OPTIONS="-c -m /var/spool/postfix/var/run/saslauthd -r "
笔记
-------------------------------------
http://blog.163.com/wqt_1101
回复