我在 Centos 6.5 上,带有 Postfix/Dovecot 和一些虚拟域。
Postfix 工作正常,但是我的邮件日志中出现很多类似这样的消息“NOQUEUE:拒绝:来自 1-160-127-12.dynamic.hinet.net[1.160.127.12] 的 RCPT:454 4.7.1:中继访问被拒绝;来自 = 到 = proto = SMTP”。
我尝试使用 iptables 关闭端口 25,这样做时我没有收到这样的消息,但我的邮件系统开始工作不正常并且无法接收来自其他主机的邮件。
请帮忙!
我的postconf -n:
alias_database = $alias_maps
alias_maps = hash:/etc/postfix/aliases
broken_sasl_auth_clients = yes
command_directory = /usr/sbin
config_directory = /etc/postfix
daemon_directory = /usr/libexec/postfix
data_directory = /var/lib/postfix
debug_peer_level = 2
html_directory = no
inet_interfaces = all
inet_protocols = ipv4
mail_owner = postfix
mailq_path = /usr/bin/mailq.postfix
manpage_directory = /usr/share/man
message_size_limit = 20971520
mydestination = localhost.$mydomain, localhost
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
smtp_tls_cert_file = /etc/pki/tls/certs/example.com.crt
smtp_tls_key_file = /etc/pki/tls/private/example.com.key
smtp_tls_loglevel = 1
smtp_tls_session_cache_database = btree:/etc/postfix/smtp_tls_session_cache
smtp_tls_session_cache_timeout = 3600s
smtp_use_tls = yes
smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination
smtpd_sasl_auth_enable = yes
smtpd_sasl_local_domain = example.com
smtpd_sasl_path = /var/run/dovecot/auth-client
smtpd_sasl_security_options = noanonymous
smtpd_sasl_tls_security_options = $smtpd_sasl_security_options
smtpd_sasl_type = dovecot
smtpd_tls_cert_file = /etc/pki/tls/certs/example.com.crt
smtpd_tls_key_file = /etc/pki/tls/private/example.com.key
smtpd_tls_loglevel = 1
smtpd_tls_received_header = yes
smtpd_tls_session_cache_database = btree:/etc/postfix/smtpd_tls_session_cache
smtpd_tls_session_cache_timeout = 3600s
smtpd_use_tls = yes
soft_bounce = yes
tls_random_source = dev:/dev/urandom
unknown_local_recipient_reject_code = 550
virtual_alias_maps = hash:/etc/postfix/vmail_aliases
virtual_gid_maps = static:2222
virtual_mailbox_base = /var/vmail
virtual_mailbox_domains = hash:/etc/postfix/vmail_domains
virtual_mailbox_maps = hash:/etc/postfix/vmail_mailbox
virtual_minimum_uid = 2222
virtual_transport = virtual
virtual_uid_maps = static:2222
请帮忙!如果需要,将附加 master.cf 或其他任何内容。
答案1
Relay_domains 应该是您接收邮件的名称。“外部世界”将连接到您的服务器(根据 DNS MX 记录)并向这些域发送邮件。坏人会尝试以相同的方式连接,但尝试向其他随机域发送电子邮件,他们将被拒绝,您将看到上面的日志消息。这完全正常。
但是,我不喜欢将您的relay_domains设置为“*”。这很糟糕,请将其恢复为默认值(或将其注释掉),即$mydestination,并确保正确设置了“mydestination”。
要允许“您的”客户端连接(将外发邮件发送到其他人的域),请检查 smtpd_recipient_restrictions(上面看起来没问题),它基本上表明“您的”网络上的人员或已经过身份验证的客户端可以发送到任何外部域。
但是我根本没看到“mynetworks”被设置,所以除非你的外发邮件客户端经过身份验证,否则它们将无法发送。你可能需要设置“mynetworks”。