Postfix向中继主机发送邮件,但中继主机通过dsn=5.0.0返回,没有进一步的详细信息。
问:我如何对此进行详细的调试,以便找出我的错误所在?
设置:
smtp-client.test.com :这是我在Debian 10上安装postfix的测试服务器。这个测试服务器模拟公司网站的情况,它应该能够发送脚本生成的电子邮件。所以没有用户的电子邮件。仅由此服务器上的脚本生成的出站电子邮件。Postfix将这些电子邮件中继到以下smtp服务器:
relayhost.test.com :这是托管服务的服务器空间。这现在是一个测试服务器,但在生产中它将充当公司邮件服务器。它使用TLS在端口587上接受smtp流量。(例如,对于Thunderbird,此服务器可以用作端口587上的smtp服务器,没有任何问题)。
问题/问题:将后缀配置为向中继主机发送邮件,但中继主机通过dsn=5.0.0 status=bounced将电子邮件发回,没有任何进一步的详细信息。
/etc/postfix/main.cf中的所有设置:
smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
biff = no
append_dot_mydomain = no
readme_directory = no
compatibility_level = 2
smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
smtpd_use_tls=yes
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
myhostname = test.mydomain.com
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = $myhostname, testX.novalocal, localhost.novalocal, localhost
relayhost = [relayhost.test.com]:587
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = loopback-only
default_transport = error
relay_transport = error
inet_protocols = all
smtp_sasl_auth_enable = yes
smtp_sasl_mechanism_filter = plain
smtp_sasl_security_options = noanonymous
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_tls_security_level = encrypt
smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt/etc/postfix/sasl_passwd看起来像:
[relayhost.test.com]:587 test@hosting.com:mypassword散列数据库文件/etc/postfix/sasl_passwd.db和重新启动后缀:
sudo postmap sasl_passwd
sudo systemctl restart postfix下一步:发送测试邮件:
mailx -s "testmail" me@testdomain.com < testmessage.txt这将导致/var/log/mail.log中的以下行:
Jan 29 23:35:26 testX postfix/postfix-script[13256]: stopping the Postfix mail system
Jan 29 23:35:26 testX postfix/master[13023]: terminating on signal 15
Jan 29 23:35:27 testX postfix/postfix-script[13384]: warning: symlink leaves directory: /etc/postfix/./makedefs.out
Jan 29 23:35:27 testX postfix/postfix-script[13420]: starting the Postfix mail system
Jan 29 23:35:27 testX postfix/master[13422]: daemon started -- version 3.4.14, configuration /etc/postfix
Jan 29 23:35:34 testX postfix/pickup[13423]: 60836C262C: uid=1000 from=
Jan 29 23:35:34 testX postfix/cleanup[13431]: 60836C262C: message-id=<20230129223534.60836C262C@smtp-client.test.com>
Jan 29 23:35:34 testX postfix/qmgr[13424]: 60836C262C: from=, size=473, nrcpt=1 (queue active)
Jan 29 23:35:34 testX postfix/error[13433]: 60836C262C: to=, relay=none, delay=0.12, delays=0.09/0.01/0/0.02, dsn=5.0.0, status=bounced ([relayhost.test.com]:587)
Jan 29 23:35:34 testX postfix/cleanup[13431]: 6C649C262D: message-id=<20230129223534.6C649C262D@smtp-client.test.com>
Jan 29 23:35:34 testX postfix/qmgr[13424]: 6C649C262D: from=<>, size=2312, nrcpt=1 (queue active)
Jan 29 23:35:34 testX postfix/bounce[13434]: 60836C262C: sender non-delivery notification: 6C649C262D
Jan 29 23:35:34 testX postfix/qmgr[13424]: 60836C262C: removed
Jan 29 23:35:34 testX postfix/local[13436]: 6C649C262D: to=, relay=local, delay=0.03, delays=0.01/0.01/0/0.01, dsn=2.0.0, status=sent (delivered to mailbox)
Jan 29 23:35:34 testX postfix/qmgr[13424]: 6C649C262D: removed我试图在mail.log中获得更多详细信息,在main.cf中添加以下行:
debug_peer_list = relayhost.test.com
debug_peer_level = 3...but --这并没有给我提供更多关于mail.log和syslog的细节。
如何在身份验证过程的哪个阶段找到中继主机拒绝连接,而不访问主机提供商(谁承载了我的中继主机)的日志?
发布于 2023-01-30 04:03:29
如果你让后缀停止错误..。
default_transport = error
relay_transport = error。。这样就行了。下次使用该功能时,请指定一个可读的状态文本:
default_transport = error:This system only processes local mail, look or ask .
relay_transport = error:This system only processes local mail, look or ask .这样,您的日志将包含一些文本,您可以搜索您的配置,以了解发生了什么。
如果您希望系统实际将邮件中继到internet (如果未设置,它们默认为smtp和relay,应该已经以适合您的用例的方式配置),请删除这些重写。
如果这不是手动配置,而是您的发行版postinst脚本由于安装过程中的选择而设置的东西,那么请Debian维护者添加明显需要的状态文本(我没有检查,只是提到了可能的情况,以防您认为配置不是您的)。
https://serverfault.com/questions/1121451
复制相似问题