![Postfix 中继访问被拒绝的问题 - 我已经阅读了所有类似的案例,并尝试了几乎所有的方法](https://linux22.com/image/573273/Postfix%20%E4%B8%AD%E7%BB%A7%E8%AE%BF%E9%97%AE%E8%A2%AB%E6%8B%92%E7%BB%9D%E7%9A%84%E9%97%AE%E9%A2%98%20-%20%E6%88%91%E5%B7%B2%E7%BB%8F%E9%98%85%E8%AF%BB%E4%BA%86%E6%89%80%E6%9C%89%E7%B1%BB%E4%BC%BC%E7%9A%84%E6%A1%88%E4%BE%8B%EF%BC%8C%E5%B9%B6%E5%B0%9D%E8%AF%95%E4%BA%86%E5%87%A0%E4%B9%8E%E6%89%80%E6%9C%89%E7%9A%84%E6%96%B9%E6%B3%95.png)
这是我第一次从头开始设置服务器,我认为自己是一个快速且善于学习新事物的人,因此我尽力在 CENTOS 6 中使用 dovecot 设置 postfix,因此我的邮件日志上出现了拒绝中继访问的情况:
警告:187.167.4.199:主机名 187-167-4-199.static.axtel.net 验证失败:名称或服务未知 1 月 20 日 23:21:35 blkarl1 postfix/smtpd[18634]:从未知 [187.167.4.199] 连接 1 月 20 日 23:22:04 blkarl1 postfix/smtpd[18634]:NOQUEUE:拒绝:来自未知 [187.167.4.199] 的 RCPT:554 5.7.1:中继访问被拒绝;来自 = 到 = proto=SMTP 1 月 20 日 23:22:08 blkarl1 postfix/smtpd[18634]:断开与未知 [187.167.4.199] 的连接
后配置-n
alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
command_directory = /usr/sbin
config_directory = /etc/postfix
daemon_directory = /usr/libexec/postfix
data_directory = /var/lib/postfix
debug_peer_level = 2
home_mailbox = Maildir/
html_directory = no
inet_interfaces = all
inet_protocols = all
mail_owner = postfix
mailq_path = /usr/bin/mailq.postfix
manpage_directory = /usr/share/man
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
mydomain = domain.com
myhostname = mail.domain.com
mynetworks = 10.178.0.0/19, 127.0.0.0/8 # I HAVE NO IDEA ABOUT THIS
myorigin = $mydomain
newaliases_path = /usr/bin/newaliases.postfix
queue_directory = /var/spool/postfix
readme_directory = /usr/share/doc/postfix-2.6.6/README_FILES
relay_domains =
sample_directory = /usr/share/doc/postfix-2.6.6/samples
sendmail_path = /usr/sbin/sendmail.postfix
setgid_group = postdrop
unknown_local_recipient_reject_code = 550
鸽舍-n
# 2.0.9: /etc/dovecot/dovecot.conf
disable_plaintext_auth = no
mail_location = maildir:~/Maildir
mbox_write_locks = fcntl
passdb {
driver = pam
}
protocols = imap pop3
ssl = no
ssl_cert = </etc/pki/dovecot/certs/dovecot.pem
ssl_key = </etc/pki/dovecot/private/dovecot.pem
userdb {
driver = passwd
}
我可以阅读我的电子邮件,但我无法向外面的任何人发送电子邮件,有人可以快速看一眼吗?
答案1
默认值未改变。
smtpd_recipient_restrictions = permit_mynetworks, reject_unauth_destination
您不是从 发送的$mynetworks
。
您不是向 发送的mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
。
也许你想要:
smtpd_recipient_restrictions = permit_mynetworks permit_sasl_authenticated reject_unauth_destination
smtpd_tls_cert_file = /etc/ssl/postfix/cert.crt
smtpd_tls_key_file = /etc/ssl/postfix/key.key
smtpd_tls_CAfile = /etc/ssl/postfix/chain.crt
smtpd_tls_loglevel = 1
smtpd_tls_security_level = may
smtpd_tls_auth_only = yes
修改证书值以使其合适。
设置 sasl 的方法变化太多,无法在此描述,但是http://www.postfix.org/SASL_README.html#server_dovecot应该是一个好的开始。