postfix+sasl邮件中,smtpd server使用mysql认证

发布于 2022-07-27 01:59:52 字数 7588 浏览 17 评论 0

系统是:SuSE10.1
安装的数据包:
postfix-2.2.9-10
postfix-mysql-2.2.9-10
dovecot-1.0.beta3-13
cyrus-sasl-2.1.21-18
cyrus-sasl-saslauthd-2.1.21-18
cyrus-sasl-digestmd5-2.1.21-18
cyrus-sasl-plain-2.1.21-18
cyrus-sasl-devel-2.1.21-18
cyrus-sasl-crammd5-2.1.21-18
cyrus-sasl-sqlauxprop-2.1.21-18
cyrus-sasl-gssapi-2.1.21-18
配置文件是:
/etc/postfix/main.cf
readme_directory = /usr/share/doc/packages/postfix/README_FILES
inet_protocols = all
biff = no
mail_spool_directory = /var/mail
canonical_maps = hash:/etc/postfix/canonical
virtual_mailbox_maps = mysql:/etc/postfix/vmaps-mysql.cf
virtual_mailbox_domains = /etc/postfix/vhosts
#virtual_alias_maps = hash:/etc/postfix/virtual
#virtual_alias_domains = hash:/etc/postfix/virtual
relocated_maps = hash:/etc/postfix/relocated
transport_maps = hash:/etc/postfix/transport
sender_canonical_maps = hash:/etc/postfix/sender_canonical
masquerade_exceptions = root
masquerade_classes = envelope_sender, header_sender, header_recipient
myhostname = xen-vm1.hasux.com
program_directory = /usr/lib/postfix
inet_interfaces = 202.82.144.90 192.168.27.3
masquerade_domains =
mydestination = $myhostname, localhost.$mydomain
relay_domains =
defer_transports =
mynetworks_style = subnet
disable_dns_lookups = no
relayhost =
mailbox_command =
mailbox_transport =
strict_8bitmime = no
disable_mime_output_conversion = no
smtpd_sender_restrictions = hash:/etc/postfix/access
smtpd_client_restrictions = permit_sasl_authenticated
smtpd_helo_required = no
smtpd_helo_restrictions =
strict_rfc821_envelopes = no
smtpd_recipient_restrictions = permit_sasl_authenticated,permit_mynetworks,rejec
t_unauth_destination
smtp_sasl_auth_enable = no
smtpd_sasl_auth_enable = yes
smtpd_sasl_local_domain = $myhostname
smtpd_sasl_security_options = noanonymous
smtpd_use_tls = no
smtp_use_tls = no
alias_maps = hash:/etc/aliases
mailbox_size_limit = 1024000000
message_size_limit = 1024000000
mydomain = antivs.com
virtual_mailbox_base = /var/spool/vmail
virtual_mailbox_limit = 1024000000
virtual_uid_maps = static:1000
virtual_gid_maps = static:1000
smtpd_sasl_application_name = smtpd

/usr/lib/sasl2/smtp.conf
pwcheck_method: auxprop
auxprop_plugin: sql
mech_list: plain login cram-md5 digest-md5
sql_engine: mysql
sql_hostnames: localhost
sql_database: postfix
sql_user: postfix
sql_passwd: postfix
sql_select: SELECT password FROM mailbox WHERE username = '%u@%r'
log_level: 7
sql_verbose: yes

系统的log:

tail -f /var/log/mail
Oct 16 10:52:21 xen-vm1 postfix/smtpd[6507]: sql auxprop plugin using mysql engine
Oct 16 10:52:22 xen-vm1 postfix/smtpd[6507]: sql plugin Parse the username fengmx@antivs.com
Oct 16 10:52:22 xen-vm1 postfix/smtpd[6507]: sql plugin try and connect to a host
Oct 16 10:52:22 xen-vm1 postfix/smtpd[6507]: sql plugin trying to open db 'postfix' on host 'localhost'
Oct 16 10:52:22 xen-vm1 postfix/smtpd[6507]: sql plugin Parse the username fengmx@antivs.com
Oct 16 10:52:22 xen-vm1 postfix/smtpd[6507]: sql plugin try and connect to a host
Oct 16 10:52:22 xen-vm1 postfix/smtpd[6507]: sql plugin trying to open db 'postfix' on host 'localhost'
Oct 16 10:52:22 xen-vm1 saslauthd[6503]: DEBUG: auth_pam: pam_authenticate failed: User not known to the underlying authentication module
Oct 16 10:52:22 xen-vm1 saslauthd[6503]: do_auth         : auth failure: [user=fengmx] [service=smtp] [realm=antivs.com] [mech=pam] [reason=PAM auth error]
Oct 16 10:52:22 xen-vm1 postfix/smtpd[6507]: sql plugin Parse the username fengmx@antivs.com
Oct 16 10:52:22 xen-vm1 postfix/smtpd[6507]: sql plugin try and connect to a host
Oct 16 10:52:22 xen-vm1 postfix/smtpd[6507]: sql plugin trying to open db 'postfix' on host 'localhost'
Oct 16 10:52:22 xen-vm1 postfix/smtpd[6507]: begin transaction
Oct 16 10:52:22 xen-vm1 postfix/smtpd[6507]: sql plugin create statement from userPassword fengmx antivs.com
Oct 16 10:52:22 xen-vm1 postfix/smtpd[6507]: sql plugin doing query SELECT password FROM mailbox WHERE username = 'fengmx@antivs.com' ;
Oct 16 10:52:22 xen-vm1 postfix/smtpd[6507]: sql plugin create statement from cmusaslsecretPLAIN fengmx antivs.com
Oct 16 10:52:22 xen-vm1 postfix/smtpd[6507]: sql plugin doing query SELECT password FROM mailbox WHERE username = 'fengmx@antivs.com' ;
Oct 16 10:52:22 xen-vm1 postfix/smtpd[6507]: commit transaction
Oct 16 10:52:22 xen-vm1 postfix/smtpd[6507]: sql plugin Parse the username fengmx@antivs.com
Oct 16 10:52:22 xen-vm1 postfix/smtpd[6507]: sql plugin try and connect to a host
Oct 16 10:52:22 xen-vm1 postfix/smtpd[6507]: sql plugin trying to open db 'postfix' on host 'localhost'
Oct 16 10:57:37 xen-vm1 postfix/smtpd[6520]: sql auxprop plugin using mysql engine

tail -f /var/log/messages:
Oct 16 10:52:21 xen-vm1 postfix/smtpd[6507]: connect from unknown[218.16.44.195]
Oct 16 10:52:22 xen-vm1 postfix/smtpd[6507]: warning: unknown[218.16.44.195]: SASL LOGIN authentication failed
Oct 16 10:52:22 xen-vm1 postfix/smtpd[6507]: lost connection after AUTH from unknown[218.16.44.195]
Oct 16 10:52:22 xen-vm1 postfix/smtpd[6507]: disconnect from unknown[218.16.44.195]
Oct 16 10:55:42 xen-vm1 postfix/anvil[6509]: statistics: max connection rate 1/60s for (smtp:218.16.44.195) at Oct 16 10:52:21
Oct 16 10:55:42 xen-vm1 postfix/anvil[6509]: statistics: max connection count 1 for (smtp:218.16.44.195) at Oct 16 10:52:21
Oct 16 10:55:42 xen-vm1 postfix/anvil[6509]: statistics: max cache size 1 at Oct 16 10:52:21
Oct 16 10:57:37 xen-vm1 postfix/smtpd[6520]: warning: 202.181.134.25: address not listed for hostname donut.udomain.com.hk
Oct 16 10:57:37 xen-vm1 postfix/smtpd[6520]: connect from unknown[202.181.134.25]
Oct 16 10:57:38 xen-vm1 postfix/smtpd[6520]: NOQUEUE: reject: RCPT from unknown[202.181.134.25]: 554 <tun@antivs.com>: Relay access denied; from=<cowpoxbait@royaltyband.com> to=<tun@antivs.com> proto=SMTP helo=<donut.udomain.com.hk>
Oct 16 10:57:38 xen-vm1 postfix/smtpd[6520]: disconnect from unknown[202.181.134.25]
Oct 16 11:00:58 xen-vm1 postfix/anvil[6522]: statistics: max connection rate 1/60s for (smtp:202.181.134.25) at Oct 16 10:57:37
Oct 16 11:00:58 xen-vm1 postfix/anvil[6522]: statistics: max connection count 1 for (smtp:202.181.134.25) at Oct 16 10:57:37
Oct 16 11:00:58 xen-vm1 postfix/anvil[6522]: statistics: max cache size 1 at Oct 16 10:57:37

  我是使用客户端的outlook来接收和发送邮件,接收邮件很正常,可是就是在客户端是用outlook发送邮件时,总是发不出去。
  在用户进行sasl认证时, 我是想使用数据库postfix来进行用户的认证,可smtp好象打不开数据库,不知道为什么?烦请各位高手指点一下,小妹已经郁闷了两个星期了!!!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文