免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 3425 | 回复: 4

[Mail] postfix+dovecot+mysql+postfixadmin 验证问题 [复制链接]

论坛徽章:
0
发表于 2015-05-20 14:28 |显示全部楼层
遇到的问题是这样的,环境是Centos 7 X86_64,php 5.3.29编译安装的,apache 2.4.12编译安装的,mysql 5.6.21编译安装的,postfix系统默认安装,使用postfixadmin创建的邮件,可以telnet 25端口没有问题,telnet 110端口的时候提示-ERR [AUTH] Authentication failed.查看mail.log看到如下的错误。
110 fail.JPG

  1. May 20 21:25:37 mail dovecot: auth-worker(6717): Error: mysql(localhost): Connect failed to database (postfix): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) - waiting for 1 seconds before retry
  2. May 20 21:25:37 mail dovecot: auth-worker(6717): Error: mysql(localhost): Connect failed to database (postfix): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) - waiting for 1 seconds before retry
  3. May 20 21:25:38 mail dovecot: auth-worker(6717): Error: mysql(localhost): Connect failed to database (postfix): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) - waiting for 5 seconds before retry
  4. May 20 21:25:38 mail dovecot: auth-worker(6717): Error: mysql(localhost): Connect failed to database (postfix): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) - waiting for 5 seconds before retry
  5. May 20 21:25:43 mail dovecot: auth-worker(6717): Error: mysql(localhost): Connect failed to database (postfix): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) - waiting for 25 seconds before retry
  6. May 20 21:25:43 mail dovecot: auth-worker(6717): Error: mysql(localhost): Connect failed to database (postfix): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) - waiting for 25 seconds before retry
  7. May 20 21:26:08 mail dovecot: auth-worker(6717): Error: mysql(localhost): Connect failed to database (postfix): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) - waiting for 125 seconds before retry
  8. May 20 21:26:08 mail dovecot: auth-worker(6717): Error: mysql(localhost): Connect failed to database (postfix): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) - waiting for 125 seconds before retry
  9. May 20 21:26:37 mail dovecot: auth-worker(6717): Error: mysql: Query timed out (no free connections for 60 secs): SELECT CONCAT('/var/vmail/', maildir) AS home, 2000 AS uid, 2000 AS gid, CONCAT('*:bytes=', quota) as quota_rule FROM mailbox WHERE username = 'test2@demo.com' AND active='1'
  10. May 20 21:26:37 mail dovecot: auth-worker(6717): Error: sql(test2@demo.com): User query failed: Not connected to database
  11. May 20 21:26:37 mail dovecot: auth: Error: auth worker: Aborted request: Lookup timed out
  12. May 20 21:26:37 mail dovecot: lda: Error: user test2@demo.com: Auth USER lookup failed
  13. May 20 21:26:37 mail dovecot: lda: Fatal: Internal error occurred. Refer to server log for more information.
  14. May 20 21:26:37 mail dovecot: auth-worker(6719): Error: mysql(localhost): Connect failed to database (postfix): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) - waiting for 1 seconds before retry
  15. May 20 21:26:38 mail postfix/pipe[6713]: 026844043CD4: to=<test2@demo.com>, relay=dovecot, delay=83731, delays=83670/0.04/0/61, dsn=4.3.0, status=deferred (temporary failure)
  16. May 20 21:26:38 mail dovecot: auth-worker(6719): Error: mysql(localhost): Connect failed to database (postfix): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) - waiting for 5 seconds before retry
  17. May 20 21:26:43 mail dovecot: auth-worker(6719): Error: mysql(localhost): Connect failed to database (postfix): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) - waiting for 25 seconds before retry
  18. May 20 21:27:08 mail dovecot: auth-worker(6719): Error: mysql(localhost): Connect failed to database (postfix): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) - waiting for 125 seconds before retry
复制代码
postfix配置如下:
  1. [root@mail ssl]# postconf -n
  2. broken_sasl_auth_clients = yes
  3. config_directory = /etc/postfix
  4. default_destination_concurrency_limit = 10
  5. default_process_limit = 500
  6. disable_dns_lookups = yes
  7. dovecot_destination_recipient_limit = 1
  8. inet_interfaces = all
  9. inet_protocols = ipv4
  10. message_size_limit = 15360000
  11. mydestination = localhost
  12. mydomain = demo.com
  13. myhostname = mail.demo.com
  14. mynetworks = 127.0.0.0/8
  15. myorigin = $mydomain
  16. proxy_read_maps = $local_recipient_maps $mydestination $virtual_alias_maps $virtual_alias_domains $virtual_mailbox_maps $virtual_mailbox_domains $relay_recipient_maps $relay_domains $canonical_maps $sender_canonical_maps $recipient_canonical_maps $relocated_maps $transport_maps $mynetworks $virtual_mailbox_limit_maps
  17. smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_invalid_hostname, reject_non_fqdn_hostname, reject_unknown_sender_domain, reject_non_fqdn_sender, reject_non_fqdn_recipient, reject_unknown_recipient_domain, reject_unauth_pipelining, reject_unauth_destination
  18. smtpd_sasl_auth_enable = yes
  19. smtpd_sasl_path = private/auth
  20. smtpd_sasl_security_options = noanonymous
  21. smtpd_sasl_type = dovecot
  22. virtual_alias_maps = proxy:mysql:/etc/postfix/mysql_virtual_alias_maps.cf
  23. virtual_gid_maps = static:2000
  24. virtual_mailbox_base = /var/vmail
  25. virtual_mailbox_domains = proxy:mysql:/etc/postfix/mysql_virtual_domains_maps.cf
  26. virtual_mailbox_limit_maps = mysql:/etc/postfix/mysql_virtual_mailbox_limit_maps.cf
  27. virtual_mailbox_maps = proxy:mysql:/etc/postfix/mysql_virtual_mailbox_maps.cf
  28. virtual_transport = dovecot
  29. virtual_uid_maps = static:2000
复制代码
dovecot 配置如下:
  1. [root@mail ssl]# dovecot -n
  2. # 2.2.10: /etc/dovecot/dovecot.conf
  3. # OS: Linux 3.10.0-229.4.2.el7.x86_64 x86_64 CentOS Linux release 7.1.1503 (Core)  xfs
  4. auth_mechanisms = plain login cram-md5
  5. dict {
  6.   quota = mysql:/etc/dovecot/dovecot-dict-sql.conf.ext
  7. }
  8. disable_plaintext_auth = no
  9. first_valid_uid = 2000
  10. last_valid_uid = 2000
  11. listen = *
  12. mail_location = maildir:/var/vmail/%d/%n
  13. mbox_write_locks = fcntl
  14. passdb {
  15.   args = /etc/dovecot/dovecot-sql.conf.ext
  16.   driver = sql
  17. }
  18. plugin {
  19.   quota = dict:User quota::proxy::quota
  20.   quota_rule = *:storage=1G
  21. }
  22. postmaster_address = postmaster@demo.com
  23. service auth {
  24.   unix_listener /var/spool/postfix/private/auth {
  25.     group = postfix
  26.     mode = 0666
  27.     user = postfix
  28.   }
  29.   unix_listener auth-client {
  30.     group = postfix
  31.     mode = 0600
  32.     user = postfix
  33.   }
  34.   unix_listener auth-userdb {
  35.     group = vmail
  36.     mode = 0600
  37.     user = vmail
  38.   }
  39. }
  40. service dict {
  41.   unix_listener dict {
  42.     group = vmail
  43.     mode = 0600
  44.     user = vmail
  45.   }
  46. }
  47. ssl_cert = </etc/pki/dovecot/certs/dovecot.pem
  48. ssl_key = </etc/pki/dovecot/private/dovecot.pem
  49. userdb {
  50.   args = /etc/dovecot/dovecot-sql.conf.ext
  51.   driver = sql
  52. }
  53. protocol lda {
  54.   mail_plugins = quota
  55. }
  56. protocol pop3 {
  57.   mail_plugins = quota
  58.   pop3_client_workarounds = outlook-no-nuls oe-ns-eoh
  59.   pop3_uidl_format = %08Xu%08Xv
  60. }
复制代码
网上找不到这个解决办法,求高手们指点,小弟在此感谢

论坛徽章:
4
IT运维版块每日发帖之星
日期:2015-09-01 06:20:00IT运维版块每日发帖之星
日期:2015-10-09 06:20:00操作系统版块每日发帖之星
日期:2015-10-20 06:20:00IT运维版块每日发帖之星
日期:2015-11-03 06:20:00
发表于 2015-05-20 18:00 |显示全部楼层
加QQ1474804934

论坛徽章:
4
IT运维版块每日发帖之星
日期:2015-09-01 06:20:00IT运维版块每日发帖之星
日期:2015-10-09 06:20:00操作系统版块每日发帖之星
日期:2015-10-20 06:20:00IT运维版块每日发帖之星
日期:2015-11-03 06:20:00
发表于 2015-05-20 18:00 |显示全部楼层
加QQ1474804934

论坛徽章:
0
发表于 2015-05-21 08:19 |显示全部楼层
没人知道嘛?

论坛徽章:
0
发表于 2015-06-05 16:30 |显示全部楼层
smtpd_sasl_path = private/auth
这一句错了。
改为
smtpd_sasl_path = smtpd

新建一个文件,路径自己调整,内容如下
pwcheck_method: auxprop
auxprop_plugin: sql
mech_list: plain login
sql_engine: mysql
sql_hostnames: 127.0.0.1
sql_user: root
sql_passwd: xxxx
sql_database: xxx
sql_select: select password from user where mail='%u@%r'
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP