- 论坛徽章:
- 0
|
初学在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里设置成
- smtpd_relay_restrictions=permit_sasl_authenticated, permit_mynetworks, reject_authenticated_sender_login_mismatch, reject_unauth_destination
复制代码
已经指定了smtp认证成功的用户可以外发邮件,但是依旧报554的错.以下是我telnet上去的过程(域名和IP改了一下)
- 220 mail.mydomain.com ESMTP Postfix
- EHLO LOCALHOST
- 250-mail.mydomain.com
- 250-PIPELINING
- 250-SIZE 10240000
- 250-VRFY
- 250-ETRN
- 250-AUTH PLAIN
- 250-ENHANCEDSTATUSCODES
- 250-8BITMIME
- 250 DSN
- auth login
- 334 VXNlcm5hbWU6
- dGVzdA==
- 334 UGFzc3dvcmQ6
- MTIzNDU2
- 235 2.0.0 Authentication successful
- MAIL FROM:<TEST@mydomain.com>
- 250 2.1.0 Ok
- RCPT TO:<123456@QQ.COM>
- 554 5.7.1 <123456@QQ.COM>: Relay access denied
复制代码
以下是我的全部main.cf配置
- queue_directory = /var/spool/postfix
- command_directory = /usr/sbin
- daemon_directory = /usr/libexec/postfix
- mail_owner = postfix
- myhostname = mail.mydomain.com
- mydomain = mydomain.com
- myorigin = $myhostname
- inet_interfaces = all
- mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
- unknown_local_recipient_reject_code = 550
- mynetworks = xxx.xxx.xxx.xxx/32, 127.0.0.0/8
- relay_domains = $mydomain
- alias_maps = hash:/etc/aliases
- alias_database = hash:/etc/aliases
- home_mailbox = Maildir/
- debug_peer_level = 2
- sendmail_path = /usr/sbin/sendmail.postfix
- newaliases_path = /usr/bin/newaliases.postfix
- mailq_path = /usr/bin/mailq.postfix
- setgid_group = postdrop
- html_directory = no
- manpage_directory = /usr/share/man
- sample_directory = /usr/share/doc/postfix-2.3.3/samples
- smtpd_sasl_type = dovecot
- smtpd_sasl_path = private/auth-client
- smtpd_sasl_auth_enable = yes
- smtpd_sasl_security_options = noanonymous
- smtpd_relay_restrictions = permit_sasl_authenticated, permit_mynetworks, reject_authenticated_sender_login_mismatch, reject_unauth_destination
- smtpd_helo_required = yes
- smtpd_helo_restrictions = reject_invalid_hostname
复制代码
这是postconf -n的输出
- alias_database = hash:/etc/aliases
- alias_maps = hash:/etc/aliases
- command_directory = /usr/sbin
- config_directory = /etc/postfix
- daemon_directory = /usr/libexec/postfix
- debug_peer_level = 2
- home_mailbox = Maildir/
- html_directory = no
- inet_interfaces = all
- mail_owner = postfix
- mailq_path = /usr/bin/mailq.postfix
- manpage_directory = /usr/share/man
- mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
- mydomain = mydomain.com
- myhostname = mail.mydomain.com
- mynetworks = xxx.xxx.xxx.xxx/32, 127.0.0.0/8
- myorigin = $myhostname
- newaliases_path = /usr/bin/newaliases.postfix
- queue_directory = /var/spool/postfix
- relay_domains = $mydomain
- sample_directory = /usr/share/doc/postfix-2.3.3/samples
- sendmail_path = /usr/sbin/sendmail.postfix
- setgid_group = postdrop
- smtpd_helo_required = yes
- smtpd_helo_restrictions = reject_invalid_hostname
- smtpd_sasl_auth_enable = yes
- smtpd_sasl_path = private/auth-client
- smtpd_sasl_security_options = noanonymous
- smtpd_sasl_type = dovecot
- unknown_local_recipient_reject_code = 550
复制代码
这是/etc/dovecot.conf
- protocols = pop3
- disable_plaintext_auth = no
- mail_location = maildir:~/Maildir
- ...
- auth default {
- mechanisms = plain
- passdb pam { }
- userdb passwd { }
- user = root
- socket listen {
- client {
- path = /var/spool/postfix/private/auth-client
- mode = 0660
- user = postfix
- group = postfix
- }
- }
- }
- dict {}
- plugin {}
复制代码
这是maillog日志
- Sep 22 20:24:06 mydomain postfix/postfix-script: starting the Postfix mail system
- Sep 22 20:24:06 mydomain postfix/master[11960]: daemon started -- version 2.3.3, configuration /etc/postfix
- Sep 22 20:24:12 mydomain postfix/smtpd[11964]: connect from unknown[210.21.232.164]
- 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>
- Sep 22 20:30:36 mydomain postfix/smtpd[11964]: timeout after RCPT from unknown[210.21.232.164]
- Sep 22 20:30:36 mydomain postfix/smtpd[11964]: disconnect from unknown[210.21.232.164]
- 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
- 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
- Sep 22 20:33:56 mydomain postfix/anvil[11966]: statistics: max cache size 1 at Sep 22 20:24:12
- Sep 22 20:38:50 mydomain postfix/postfix-script: stopping the Postfix mail system
- Sep 22 20:38:50 mydomain postfix/master[11960]: terminating on signal 15
- Sep 22 20:38:50 mydomain postfix/postfix-script: starting the Postfix mail system
- Sep 22 20:38:50 mydomain postfix/master[12077]: daemon started -- version 2.3.3, configuration /etc/postfix
- Sep 22 20:39:06 mydomain postfix/smtpd[12081]: connect from unknown[210.21.232.164]
- 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>
- Sep 22 20:41:01 mydomain postfix/smtpd[12081]: disconnect from unknown[210.21.232.164]
- Sep 22 20:41:33 mydomain postfix/postfix-script: stopping the Postfix mail system
- Sep 22 20:41:33 mydomain postfix/master[12077]: terminating on signal 15
- Sep 22 20:41:33 mydomain dovecot: Killed with signal 15
复制代码
烦请各位大神指点小弟一二,问题困扰好久都不知道是什么问题,谢谢了!!!
|
|