免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2796 | 回复: 1
打印 上一主题 下一主题

[Mail] Postfix指定smtp认证客户端发送邮件不成功? [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2013-09-22 23:15 |只看该作者 |倒序浏览
初学在VPS环境下用yum安装了Postfix+dovecot,在服务器上用telnet发送邮件正常,用foxmail收邮件正常,发邮件不正常,提示错误信息:554 5.7.1 <xxx@qq.com>: Relay access denied.

查了配置和日志很久,测试应该是/etc/postfix/main.cf 里面smtpd_relay_restrictions参数引起的,只要我把mynetwork改成0.0.0.0/0或者添加我客户端公网IP进去就能正常收发邮件.

但我已经在smtpd_relay_restrictions里设置成
  1. smtpd_relay_restrictions=permit_sasl_authenticated, permit_mynetworks, reject_authenticated_sender_login_mismatch, reject_unauth_destination
复制代码


已经指定了smtp认证成功的用户可以外发邮件,但是依旧报554的错.以下是我telnet上去的过程(域名和IP改了一下)
  1. 220 mail.mydomain.com ESMTP Postfix
  2. EHLO LOCALHOST
  3. 250-mail.mydomain.com
  4. 250-PIPELINING
  5. 250-SIZE 10240000
  6. 250-VRFY
  7. 250-ETRN
  8. 250-AUTH PLAIN
  9. 250-ENHANCEDSTATUSCODES
  10. 250-8BITMIME
  11. 250 DSN
  12. auth login
  13. 334 VXNlcm5hbWU6
  14. dGVzdA==
  15. 334 UGFzc3dvcmQ6
  16. MTIzNDU2
  17. 235 2.0.0 Authentication successful
  18. MAIL FROM:<TEST@mydomain.com>
  19. 250 2.1.0 Ok
  20. RCPT TO:<123456@QQ.COM>
  21. 554 5.7.1 <123456@QQ.COM>: Relay access denied
复制代码


以下是我的全部main.cf配置
  1. queue_directory = /var/spool/postfix
  2. command_directory = /usr/sbin
  3. daemon_directory = /usr/libexec/postfix
  4. mail_owner = postfix
  5. myhostname = mail.mydomain.com
  6. mydomain = mydomain.com
  7. myorigin = $myhostname
  8. inet_interfaces = all
  9. mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
  10. unknown_local_recipient_reject_code = 550
  11. mynetworks = xxx.xxx.xxx.xxx/32, 127.0.0.0/8
  12. relay_domains = $mydomain
  13. alias_maps = hash:/etc/aliases
  14. alias_database = hash:/etc/aliases
  15. home_mailbox = Maildir/
  16. debug_peer_level = 2
  17. sendmail_path = /usr/sbin/sendmail.postfix
  18. newaliases_path = /usr/bin/newaliases.postfix
  19. mailq_path = /usr/bin/mailq.postfix
  20. setgid_group = postdrop
  21. html_directory = no
  22. manpage_directory = /usr/share/man
  23. sample_directory = /usr/share/doc/postfix-2.3.3/samples
  24. smtpd_sasl_type = dovecot
  25. smtpd_sasl_path = private/auth-client
  26. smtpd_sasl_auth_enable = yes
  27. smtpd_sasl_security_options = noanonymous
  28. smtpd_relay_restrictions = permit_sasl_authenticated, permit_mynetworks, reject_authenticated_sender_login_mismatch, reject_unauth_destination
  29. smtpd_helo_required = yes
  30. smtpd_helo_restrictions = reject_invalid_hostname
复制代码


这是postconf -n的输出
  1. alias_database = hash:/etc/aliases
  2. alias_maps = hash:/etc/aliases
  3. command_directory = /usr/sbin
  4. config_directory = /etc/postfix
  5. daemon_directory = /usr/libexec/postfix
  6. debug_peer_level = 2
  7. home_mailbox = Maildir/
  8. html_directory = no
  9. inet_interfaces = all
  10. mail_owner = postfix
  11. mailq_path = /usr/bin/mailq.postfix
  12. manpage_directory = /usr/share/man
  13. mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
  14. mydomain = mydomain.com
  15. myhostname = mail.mydomain.com
  16. mynetworks = xxx.xxx.xxx.xxx/32, 127.0.0.0/8
  17. myorigin = $myhostname
  18. newaliases_path = /usr/bin/newaliases.postfix
  19. queue_directory = /var/spool/postfix
  20. relay_domains = $mydomain
  21. sample_directory = /usr/share/doc/postfix-2.3.3/samples
  22. sendmail_path = /usr/sbin/sendmail.postfix
  23. setgid_group = postdrop
  24. smtpd_helo_required = yes
  25. smtpd_helo_restrictions = reject_invalid_hostname
  26. smtpd_sasl_auth_enable = yes
  27. smtpd_sasl_path = private/auth-client
  28. smtpd_sasl_security_options = noanonymous
  29. smtpd_sasl_type = dovecot
  30. unknown_local_recipient_reject_code = 550
复制代码


这是/etc/dovecot.conf
  1. protocols = pop3
  2. disable_plaintext_auth = no
  3. mail_location = maildir:~/Maildir
  4. ...
  5. auth default {
  6.   mechanisms = plain
  7.   passdb pam {  }
  8.   userdb passwd {  }
  9.   user = root
  10.   socket listen {
  11.     client {
  12.       path = /var/spool/postfix/private/auth-client
  13.       mode = 0660
  14.       user = postfix
  15.       group = postfix
  16.     }
  17.   }
  18. }
  19. dict {}
  20. plugin {}
复制代码


这是maillog日志
  1. Sep 22 20:24:06 mydomain postfix/postfix-script: starting the Postfix mail system
  2. Sep 22 20:24:06 mydomain postfix/master[11960]: daemon started -- version 2.3.3, configuration /etc/postfix
  3. Sep 22 20:24:12 mydomain postfix/smtpd[11964]: connect from unknown[210.21.232.164]
  4. Sep 22 20:25:36 mydomain postfix/smtpd[11964]: NOQUEUE: reject: RCPT from unknown[210.21.232.164]: 554 5.7.1 <123456@qq.com>: Relay access denied; from=<test@mydomain.com> to=<123456@qq.com> proto=ESMTP helo=<LOCALHOST>
  5. Sep 22 20:30:36 mydomain postfix/smtpd[11964]: timeout after RCPT from unknown[210.21.232.164]
  6. Sep 22 20:30:36 mydomain postfix/smtpd[11964]: disconnect from unknown[210.21.232.164]
  7. Sep 22 20:33:56 mydomain postfix/anvil[11966]: statistics: max connection rate 1/60s for (smtp:210.21.232.164) at Sep 22 20:24:12
  8. Sep 22 20:33:56 mydomain postfix/anvil[11966]: statistics: max connection count 1 for (smtp:210.21.232.164) at Sep 22 20:24:12
  9. Sep 22 20:33:56 mydomain postfix/anvil[11966]: statistics: max cache size 1 at Sep 22 20:24:12
  10. Sep 22 20:38:50 mydomain postfix/postfix-script: stopping the Postfix mail system
  11. Sep 22 20:38:50 mydomain postfix/master[11960]: terminating on signal 15
  12. Sep 22 20:38:50 mydomain postfix/postfix-script: starting the Postfix mail system
  13. Sep 22 20:38:50 mydomain postfix/master[12077]: daemon started -- version 2.3.3, configuration /etc/postfix
  14. Sep 22 20:39:06 mydomain postfix/smtpd[12081]: connect from unknown[210.21.232.164]
  15. Sep 22 20:40:51 mydomain postfix/smtpd[12081]: NOQUEUE: reject: RCPT from unknown[210.21.232.164]: 554 5.7.1 <123456@qq.com>: Relay access denied; from=<test@mydomain.com> to=<123456@qq.com> proto=ESMTP helo=<LOCALHOST>
  16. Sep 22 20:41:01 mydomain postfix/smtpd[12081]: disconnect from unknown[210.21.232.164]
  17. Sep 22 20:41:33 mydomain postfix/postfix-script: stopping the Postfix mail system
  18. Sep 22 20:41:33 mydomain postfix/master[12077]: terminating on signal 15
  19. Sep 22 20:41:33 mydomain dovecot: Killed with signal 15
复制代码


烦请各位大神指点小弟一二,问题困扰好久都不知道是什么问题,谢谢了!!!

论坛徽章:
0
2 [报告]
发表于 2013-09-23 22:47 |只看该作者
本帖最后由 tseyuzen 于 2013-09-23 22:48 编辑

问题解决了,是写错参数导致
  1. smtpd_relay_restrictions = permit_sasl_authenticated, permit_mynetworks, reject_authenticated_sender_login_mismatch, reject_unauth_destination
复制代码
应换成
  1. smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination
复制代码
后来还是发不出,把下面两行注释掉就好了
  1. #smtpd_helo_required = yes
  2. #smtpd_helo_restrictions = reject_invalid_hostname
复制代码
继续学习...
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

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

清除 Cookies - ChinaUnix - Archiver - WAP - TOP