此主机不允许 550 中继

此主机不允许 550 中继

我正在多台服务器(9 Linux Suse 11 和 Linux Suse 12)7/9(电子邮件工作)(全部在同一个网络下)上工作,能够像下面的脚本一样发送电子邮件,我需要将电子邮件从 shell 脚本发送到外部域。

mailx  -a /opt/script/log/status.log  -S smtp=[..].net -r 
"[email protected]" -s "$HOSTNAME critical_subject " -v "[email protected]" << EOF
Critical Status found during the Monitoring and Control Operation. Please 
check the Attach Log.
EOF

结果我得到了这个:

  Resolving host [..] . . . done.
Connecting to [..]:smtp . . . connected.
220 [..] ESMTP Wed, 02 Aug 2017 09:42:58 +0200
>>> HELO a.b.c
250 a.b.c.Hello [..]
>>> MAIL FROM:<[email protected]>
250 OK
>>> RCPT TO:<[email protected]>
550 relay is not permitted on this host.
smtp-server: 550 relay is not permitted on this host.
"/root/dead.letter" 102/5133
. . . message not sent.

有什么建议吗?我可以提供哪些信息?

主配置文件

queue_directory = /var/spool/postfix
command_directory = /usr/sbin
daemon_directory = /usr/lib/postfix
data_directory = /var/lib/postfix

mail_owner = postfix


# REJECTING MAIL FOR UNKNOWN LOCAL USERS
unknown_local_recipient_reject_code = 550

smtpd_banner = $myhostname ESMTP


debug_peer_level = 2
debugger_command =
     PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin
     ddd $daemon_directory/$process_name $process_id & sleep 5

sendmail_path = /usr/sbin/sendmail
newaliases_path = /usr/bin/newaliases
mailq_path = /usr/bin/mailq

setgid_group = maildrop

html_directory = /usr/share/doc/packages/postfix-doc/html
manpage_directory = /usr/share/man
sample_directory = /usr/share/doc/packages/postfix-doc/samples
readme_directory = /usr/share/doc/packages/postfix-doc/README_FILES

biff = no
content_filter = 
delay_warning_time = 1h
disable_dns_lookups = no
disable_mime_output_conversion = no
disable_vrfy_command = yes
inet_interfaces = localhost
inet_protocols = all
masquerade_classes = envelope_sender, header_sender, header_recipient
masquerade_domains = 
masquerade_exceptions = root
mydestination = $myhostname, localhost.$mydomain
myhostname = domain.domain.net
mynetworks_style = subnet
mynetworks= [list of ip in subnet form]
relayhost = relay_adress

alias_maps = hash:/etc/aliases
canonical_maps = hash:/etc/postfix/canonical
relocated_maps = hash:/etc/postfix/relocated
sender_canonical_maps = hash:/etc/postfix/sender_canonical
transport_maps = hash:/etc/postfix/transport
mail_spool_directory = /var/mail
message_strip_characters = \0
defer_transports = 
mailbox_command = 
mailbox_transport = 
mailbox_size_limit = 0
message_size_limit = 0
strict_8bitmime = no
strict_rfc821_envelopes = no
smtpd_delay_reject = yes
smtpd_helo_required = no

smtpd_client_restrictions = 

smtpd_helo_restrictions = 

smtpd_sender_restrictions = hash:/etc/postfix/access

smtpd_recipient_restrictions = permit_mynetworks,reject_unauth_destination


############################################################
# SASL stuff
############################################################
smtp_sasl_auth_enable = no
smtp_sasl_security_options = 
smtp_sasl_password_maps = 
smtpd_sasl_auth_enable = no
############################################################
# TLS stuff
############################################################
relay_clientcerts = 

smtp_use_tls = no
smtp_enforce_tls = no
smtp_tls_CAfile = 
smtp_tls_CApath = 
smtp_tls_cert_file = 
smtp_tls_key_file = 
smtp_tls_session_cache_database = 

smtpd_use_tls = no
smtpd_tls_CAfile = 
smtpd_tls_CApath = 
smtpd_tls_cert_file = 
smtpd_tls_key_file = 
smtpd_tls_ask_ccert = no
smtpd_tls_received_header = no

############################################################
# Start MySQL from postfixwiki.org
############################################################
relay_domains = $mydestination, hash:/etc/postfix/relay
virtual_alias_domains = hash:/etc/postfix/virtual
virtual_alias_maps = hash:/etc/postfix/virtual

更新:由于某种原因,我无法从该主机发送电子邮件。因此,我尝试使用 7 台正常工作的机器中的一台来发送电子邮件。在“损坏”的机器上添加了 mynetworks ip 列表,并将 realy_host 作为我想用作中继的工作地址。在中继中,我在 mynetworks 中添加了损坏的机器的地址。没有用

更新2:这是客户客户端的 SMTP 问题。我将关闭该问题。

答案1

由于此错误出现RCPT TO:,相应的 Postfix 配置参数是smtpd_recipient_restrictions或者smtpd_relay_restrictions,取决于:

在 Postfix 2.10 之前的版本中,中继权限和垃圾邮件拦截规则在 下合并smtpd_recipient_restrictions,导致配置容易出错。从 Postfix 2.10 开始,中继权限规则最好在 下实现 smtpd_relay_restrictions,这样 下的宽松垃圾邮件拦截策略smtpd_recipient_restrictions将不再导致宽松的邮件中继策略。

你有

smtpd_recipient_restrictions = permit_mynetworks,reject_unauth_destination

并且由于不存在,您smtpd_relay_restrictions就会陷入违约:

smtpd_relay_restrictions =
    permit_mynetworks, permit_sasl_authenticated, defer_unauth_destination

由于你的脚本未使用 SASL 进行身份验证,因此它应该被允许permit_mynetworks,即它必须在mynetworks。您没有在配置中指定它,但您可以使用来检查它postconf | grep "mynetworks = "。由于您连接到外部接口而不是本地主机(smtp=[..].net),因此它应该包含外部 IP。

这可能会影响mynetworks,导致您的服务器之间存在差异:

指定mynetworks_style = subnetPostfix 何时应“信任”与本地计算机位于同一 IP 子网中的远程 SMTP 客户端。在 Linux 上,这仅在使用该 ifconfig命令指定的接口下才能正常工作。

因此,最好指定mynetworks手动参数,例如

mynetworks = 127.0.0.0/8 198.51.100.10/32

相关内容