后缀查找失败:从本地主机,而不是局域网中的其他节点

当在同一networking上尝试使用Postfix和Gmail从主机以外的其他机器发送电子邮件时,我收到临时查找失败的收件人地址。 在Postfix主机上testing时,它工作得很好。 编辑:我有一个客户端节点在同一局域网问这个Postfix服务器发送一封电子邮件。 服务器拒绝,引用临时查找失败。

为了得到我所在的地方,我遵循了这些指示:
https://rtcamp.com/tutorials/linux/ubuntu-postfix-gmail-smtp/
然后,我将mynetworks参数更改为包含我们LAN的.3子网上的任何节点。

我试图解决这个问题:
1)为特定的电子邮件地址添加别名,然后运行新的别名
2)将relay_domains添加到main.cf
3)将sasl_passwd文件更改为包含:smtp.gmail.com或COMPANYNAME.com
4)在main.cf中将relay_host的值更改为smtp.gmail.com或smtp.COMPANYNAME.com
5)在main.cf中改变mydestinations的值

这是我的main.cf:

smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu) biff = no # appending .domain is the MUA's job. append_dot_mydomain = no # Uncomment the next line to generate "delayed mail" warnings #delay_warning_time = 4h readme_directory = no # TLS parameters 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 # See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for # information on enabling SSL in the smtp client. myhostname = hans alias_maps = hash:/etc/aliases alias_database = hash:/etc/aliases myorigin = /etc/mailname mydestination = smtp.COMPANYNAME.com, COMPANYNAME.com, smtp.gmail.com, localhost.localdomain, localhost relayhost = [smtp.gmail.com]:587 relay_domains = COMPANYNAME.com, gmail.com mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128, 192.168.3.0/255 mailbox_size_limit = 0 recipient_delimiter = + inet_interfaces = all smtp_sasl_auth_enable = yes smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd smtp_sasl_security_options = noanonymous smtp_tls_CAfile = /etc/postfix/cacert.pem smtp_use_tls = yes 

更新:这是我的mail.log,我正在修复networking掩码问题。 仍然不知道如何解决临时查找问题。

 Jan 30 15:42:07 hans postfix/smtpd[10994]: NOQUEUE: reject: RCPT from unknown[192.168.3.3]: 451 4.3.0 <[email protected]>: Temporary lookup failure; from=<[email protected]> to=<[email protected]> proto=SMTP helo=<localhost> Jan 30 15:42:07 hans postfix/smtpd[10994]: warning: bad net/mask pattern: "192.168.3.0/255" 

更新2:我做了很多改变我的main.cf。 这是最新的一个。

 smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu) biff = no # appending .domain is the MUA's job. append_dot_mydomain = no # Uncomment the next line to generate "delayed mail" warnings #delay_warning_time = 4h readme_directory = no # TLS parameters 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 # See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for # information on enabling SSL in the smtp client. myhostname = hans alias_maps = hash:/etc/aliases alias_database = hash:/etc/aliases myorigin = /etc/mailname mydestination = hans, localhost.localdomain, localhost relayhost = [smtp.gmail.com]:587 relay_transport = relay relay_domains = mail.companyname.com, companyname.com, gmail.com mynetworks_style = subnet mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 [192.168.3.0]/255 mailbox_size_limit = 0 recipient_delimiter = + inet_interfaces = all smtp_sasl_auth_enable = yes smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd smtp_sasl_security_options = noanonymous smtp_tls_CAfile = /etc/postfix/cacert.pem smtp_use_tls = yes smtp_sasl_tls_security_options = noanonymous smtp_connection_cache_destinations = smtp.gmail.com smtpd_recipient_restrictions = permit_sasl_authenticated, permit_mynetworks, permit_auth_destination, reject_unauth_destination smtpd_sender_restrictions = permit_mynetworks, check_relay_domains 

最新的错误日志:

这些是最新的消息,但是我已经弄清楚了,它已经不再适合了。

 Feb 3 15:10:17 hans postfix/smtpd[18037]: fatal: parameter "smtpd_recipient_restrictions": specify at least one working instance of: check_relay_domains, reject_unauth_destination, reject, defer or defer_if_permit 

来自其他人的build议:有人告诉我,我需要在客户端和Postfix服务器之间build立适当的DNS。 显然是在我的configuration中列出的子网是不够的。 我不确定它是否相关,因为整体上Postfix不应该做本地查找,而是将电子邮件发送到Gmail。 我错了吗?

Postfix本身有文档介绍如何在出现问题时进行debugging 。 对于debuggingpostfix过程,maillog是你的朋友。 debugging的第一步是发出这个命令

 egrep '(warning|error|fatal|panic):' /some/log/file | more 

从maillog我们可以看到,后缀抱怨bad net/mask pattern: "192.168.3.0/255" 。 从你的main.cf ,我们可以确定在我的mynetworks (192.168.3.0/255)上有一个IP地址有错误的模式。 也许你的意思是192.168.3.0/32。

好的,但为什么从本地主机,而不是局域网中的其他节点

一些推测性的答案:

  • 您使用mail命令从locahost发送电子邮件。 在这种模式下,postfix甚至不会使用mynetworks参数。
  • 您使用smtpd发送电子邮件(通过telnet localhost 25 )。 使用这种模式,postfix只检查我的mynetworks (即127.0.0.0/8)的第一个条目,并发现客户端匹配这个条目,所以postfix甚至不打扰检查mynetworks条目列表的其余部分。