![postfix:远程主机拒绝中继访问](https://linux22.com/image/779806/postfix%EF%BC%9A%E8%BF%9C%E7%A8%8B%E4%B8%BB%E6%9C%BA%E6%8B%92%E7%BB%9D%E4%B8%AD%E7%BB%A7%E8%AE%BF%E9%97%AE.png)
我有一个用作主邮件服务器的 postfix 实例,它将所有外发邮件中继到另一个 postfix 实例(使用relayhost
),然后将邮件转发到相应的目的地。在此配置下,一切都运行良好(特别是,SPF/DKIM 全部设置完毕,远程邮件服务器完全可以接受中继邮件),其中中继 postfix 在 Debian 上本机运行。
现在我想用 Docker 内部运行的基于 Alpine Linux 的中继后缀替换中继后缀(其默认配置可能与 Debian 略有不同)。完整配置main.cf
如下(空白行之前的所有内容均来自系统的默认配置,空白行以下的所有内容均为我明确设置的):
compatibility_level = 3.7
queue_directory = /var/spool/postfix
command_directory = /usr/sbin
daemon_directory = /usr/libexec/postfix
data_directory = /var/lib/postfix
mail_owner = postfix
unknown_local_recipient_reject_code = 550
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 = postdrop
html_directory = no
manpage_directory = /usr/share/man
sample_directory = /etc/postfix
readme_directory = /usr/share/doc/postfix/readme
inet_protocols = ipv4
shlib_directory = /usr/lib/postfix
meta_directory = /etc/postfix
maillog_file = /dev/stdout
smtpd_banner = $myhostname ESMTP $mydomain (Linux/GNU)
biff = no
append_dot_mydomain = no
alias_maps = lmdb:/etc/aliases
alias_database = lmdb:/etc/aliases
message_size_limit = 30000000
mydestination = localdomain, localhost, localhost.localdomain
myhostname = relay.domob.eu
myorigin = domob.eu
mydomain = domob.eu
smtpd_sasl_type = cyrus
cyrus_sasl_config_path = /etc/postfix/sasl/
smtpd_sasl_local_domain = localhost
smtpd_sasl_path = smtpd
smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
smtp_use_tls = yes
smtp_tls_security_level = may
smtpd_use_tls = yes
smtpd_tls_security_level = encrypt
smtpd_tls_key_file = /etc/ssl/postfix/key.pem
smtpd_tls_cert_file = /etc/ssl/postfix/cert.pem
smtpd_relay_restrictions = permit_sasl_authenticated, reject_unauth_destination
smtpd_recipient_restrictions = permit_sasl_authenticated, reject_unauth_destination
这不起作用。如果我尝试发送外发邮件,我相信它会顺利地转发到 Docker 内部的 postfix,在那里被接受,但随后被远程主机拒绝。日志如下:
relay-postfix-postfix-1 | Aug 24 13:51:23 relay postfix/smtpd[83]: connect from unknown[172.30.0.1]
relay-postfix-postfix-1 | Aug 24 13:51:23 relay postfix/smtpd[83]: 784B361A73: client=unknown[172.30.0.1], sasl_method=PLAIN, sasl_username=rpi@localhost
relay-postfix-postfix-1 | Aug 24 13:51:23 relay postfix/cleanup[88]: 784B361A73: message-id=<[email protected]>
relay-postfix-postfix-1 | Aug 24 13:51:23 relay postfix/qmgr[75]: 784B361A73: from=<[email protected]>, size=3834, nrcpt=1 (queue active)
relay-postfix-postfix-1 | Aug 24 13:51:23 relay postfix/smtpd[83]: disconnect from unknown[172.30.0.1] ehlo=2 starttls=1 auth=1 mail=1 rcpt=1 data=1 quit=1 commands=8
relay-postfix-postfix-1 | Aug 24 13:51:24 relay postfix/smtp[89]: 784B361A73: to=<[email protected]>, relay=gmail-smtp-in.l.google.com[66.102.1.26]:25, delay=0.74, delays=0.03/0.02/0.66/0.03, dsn=5.7.1, status=bounced (host gmail-smtp-in.l.google.com[66.102.1.26] said: 554 5.7.1 <[email protected]>: Relay access denied (in reply to RCPT TO command))
relay-postfix-postfix-1 | Aug 24 13:51:24 relay postfix/cleanup[88]: 39DAB61A75: message-id=<[email protected]>
relay-postfix-postfix-1 | Aug 24 13:51:24 relay postfix/qmgr[75]: 39DAB61A75: from=<>, size=5840, nrcpt=1 (queue active)
relay-postfix-postfix-1 | Aug 24 13:51:24 relay postfix/bounce[90]: 784B361A73: sender non-delivery notification: 39DAB61A75
relay-postfix-postfix-1 | Aug 24 13:51:24 relay postfix/qmgr[75]: 784B361A73: removed
relay-postfix-postfix-1 | Aug 24 13:51:25 relay postfix/smtp[89]: 39DAB61A75: to=<[email protected]>, relay=mail.domob.eu[51.68.174.164]:25, delay=0.99, delays=0/0/0.52/0.46, dsn=2.0.0, status=sent (250 2.0.0 Ok: queued as BD1473EC67)
relay-postfix-postfix-1 | Aug 24 13:51:25 relay postfix/qmgr[75]: 39DAB61A75: removed
不幸的是,我找到的所有关于“中继访问被拒绝”的信息总是关于中继后缀拒绝访问,而不是远程主机(当然我也没有权限访问 Gmail 的服务器日志)。我的配置/设置有什么问题?