邮件循环回到我自己

邮件循环回到我自己

我知道有很多这样的问题。但是没有人遇到与这里描述的相同的情况。以下是这种情况。

我有一个静态 IP。我正在虚拟机中设置我的 postfix 邮件服务器。我的静态 IP 定义在我的服务器的一个接口中。我的服务器也是我的虚拟机的主机。我的 iptables 中有一个 MASQUERADE 跳转,用于服务器的两个接口之间的流量。总而言之,我的服务器有 2 个接口。其中一个具有静态公共 IP,另一个具有静态内部 IP(192.168.1.0/24)。

我的 postfix 邮件服务器的 IP 为 192.168.1.4。我能够接收来自外部的电子邮件并在内部发送电子邮件。但是,我发送给外部邮件提供商(yahoo、hotmal、gmail..)的所有电子邮件都因未送达而退回。电子邮件似乎已经发出。它没有被拒绝(我认为)。它在发送后被退回。

让我这样想的是邮件日志。正如您在下面的日志中看到的,带有 ** 的行表示电子邮件已发送。

Jun 16 14:39:28 mail postfix/smtpd[2740]: connect from unknown[192.168.1.22]
Jun 16 14:39:29 mail postfix/smtpd[2740]: CD845120353: client=unknown[192.168.1.22], sasl_method=PLAIN, [email protected]
Jun 16 14:39:29 mail postfix/cleanup[2746]: CD845120353: message-id=<[email protected]>
Jun 16 14:39:29 mail postfix/qmgr[2739]: CD845120353: from=<[email protected]>, size=1926, nrcpt=1 (queue active)
Jun 16 14:39:29 mail amavis[1278]: (01278-01) ESMTP::10024 /var/lib/amavis/tmp/amavis-20130616T143929-01278-S08QTJqD: <[email protected]> -> <[email protected]> SIZE=1926 Received: from mail.thegeekbeaver.ca ([127.0.0.1]) by localhost (mail.thegeekbeaver.ca [127.0.0.1]) (amavisd-new, port 10024) with ESMTP for <[email protected]>; Sun, 16 Jun 2013 14:39:29 -0400 (EDT)
Jun 16 14:39:29 mail amavis[1278]: (01278-01) Checking: xqb7Jpib5ubO [192.168.1.22] <[email protected]> -> <[email protected]>
Jun 16 14:39:32 mail postfix/smtpd[2750]: connect from localhost[127.0.0.1]
Jun 16 14:39:32 mail postfix/smtpd[2750]: D1F5612039C: client=localhost[127.0.0.1]
Jun 16 14:39:32 mail postfix/cleanup[2746]: D1F5612039C: message-id=<[email protected]>
Jun 16 14:39:32 mail postfix/qmgr[2739]: D1F5612039C: from=<[email protected]>, size=2384, nrcpt=1 (queue active)
Jun 16 14:39:32 mail amavis[1278]: (01278-01) FWD from <[email protected]> -> <[email protected]>,BODY=7BIT 250 2.0.0 from MTA(smtp:[127.0.0.1]:10025): 250 2.0.0 Ok: queued as D1F5612039C
Jun 16 14:39:32 mail postfix/smtp[2752]: name_mask: ipv4
Jun 16 14:39:32 mail postfix/smtp[2752]: inet_addr_local: configured 2 IPv4 addresses
Jun 16 14:39:32 mail postfix/smtp[2752]: process generation: 12 (12)
Jun 16 14:39:32 mail postfix/smtp[2752]: name_mask: 0
Jun 16 14:39:32 mail postfix/smtp[2752]: auto_clnt_create: transport=local endpoint=private/tlsmgr
Jun 16 14:39:32 mail postfix/smtp[2752]: auto_clnt_open: connected to private/tlsmgr
Jun 16 14:39:32 mail postfix/smtp[2752]: send attr request = seed
Jun 16 14:39:32 mail postfix/smtp[2752]: send attr size = 32
Jun 16 14:39:32 mail postfix/smtp[2752]: private/tlsmgr: wanted attribute: status
Jun 16 14:39:32 mail postfix/smtp[2752]: input attribute name: status
Jun 16 14:39:32 mail postfix/smtp[2752]: input attribute value: 0
Jun 16 14:39:32 mail postfix/smtp[2752]: private/tlsmgr: wanted attribute: seed
Jun 16 14:39:32 mail postfix/smtp[2752]: input attribute name: seed
Jun 16 14:39:32 mail postfix/smtp[2752]: input attribute value: rhc/7qzeS6ovv1yxELZ2Ild7yLTt4rpDpcyonn0Iaqw=
Jun 16 14:39:32 mail postfix/smtp[2752]: private/tlsmgr: wanted attribute: (list terminator)
Jun 16 14:39:32 mail postfix/smtp[2752]: input attribute name: (end)
Jun 16 14:39:32 mail postfix/smtp[2752]: send attr request = policy
Jun 16 14:39:32 mail postfix/smtp[2752]: send attr cache_type = smtp
Jun 16 14:39:32 mail postfix/smtp[2752]: private/tlsmgr: wanted attribute: status
Jun 16 14:39:32 mail postfix/smtp[2752]: input attribute name: status
Jun 16 14:39:32 mail postfix/smtp[2752]: input attribute value: 0
Jun 16 14:39:32 mail postfix/smtp[2752]: private/tlsmgr: wanted attribute: cachable
Jun 16 14:39:32 mail postfix/smtp[2752]: input attribute name: cachable
Jun 16 14:39:32 mail postfix/smtp[2752]: input attribute value: 1
Jun 16 14:39:32 mail postfix/smtp[2752]: private/tlsmgr: wanted attribute: (list terminator)
Jun 16 14:39:32 mail postfix/smtp[2752]: input attribute name: (end)
Jun 16 14:39:32 mail postfix/smtp[2752]: match_string: fast_flush_domains ~? debug_peer_list
Jun 16 14:39:32 mail postfix/smtp[2752]: match_string: fast_flush_domains ~? fast_flush_domains
Jun 16 14:39:32 mail postfix/smtp[2752]: name_mask: canonical
Jun 16 14:39:32 mail postfix/smtp[2752]: name_mask: virtual
Jun 16 14:39:32 mail postfix/smtp[2752]: name_mask: dns
Jun 16 14:39:32 mail postfix/smtp[2752]: host name lookup methods: dns
Jun 16 14:39:32 mail postfix/smtp[2752]: auto_clnt_create: transport=local endpoint=private/scache
Jun 16 14:39:32 mail postfix/smtp[2752]: connection established
Jun 16 14:39:32 mail postfix/smtp[2752]: master_notify: status 0
Jun 16 14:39:32 mail postfix/smtp[2752]: deliver_request_initial: send initial status
Jun 16 14:39:32 mail postfix/smtp[2752]: send attr status = 0
Jun 16 14:39:32 mail postfix/smtp[2752]: smtp socket: wanted attribute: flags
Jun 16 14:39:32 mail postfix/smtp[2752]: input attribute name: flags
Jun 16 14:39:32 mail postfix/smtp[2752]: input attribute value: 3
Jun 16 14:39:32 mail postfix/smtp[2752]: smtp socket: wanted attribute: queue_name
Jun 16 14:39:32 mail postfix/smtp[2752]: input attribute name: queue_name
Jun 16 14:39:32 mail postfix/smtp[2752]: input attribute value: active
Jun 16 14:39:32 mail postfix/smtp[2752]: smtp socket: wanted attribute: queue_id
Jun 16 14:39:32 mail postfix/smtp[2752]: input attribute name: queue_id
Jun 16 14:39:32 mail postfix/smtp[2752]: input attribute value: D1F5612039C
Jun 16 14:39:32 mail postfix/smtp[2752]: smtp socket: wanted attribute: offset
Jun 16 14:39:32 mail postfix/smtp[2752]: input attribute name: offset
Jun 16 14:39:32 mail postfix/smtp[2752]: input attribute value: 625
Jun 16 14:39:32 mail postfix/smtp[2752]: smtp socket: wanted attribute: size
Jun 16 14:39:32 mail postfix/smtp[2752]: input attribute name: size
Jun 16 14:39:32 mail postfix/smtp[2752]: input attribute value: 2384
Jun 16 14:39:32 mail postfix/smtp[2752]: smtp socket: wanted attribute: nexthop
Jun 16 14:39:32 mail postfix/smtp[2752]: input attribute name: nexthop
Jun 16 14:39:32 mail postfix/smtp[2752]: input attribute value: ig.com.br
Jun 16 14:39:32 mail postfix/smtp[2752]: smtp socket: wanted attribute: encoding
Jun 16 14:39:32 mail postfix/smtp[2752]: input attribute name: encoding
Jun 16 14:39:32 mail postfix/smtp[2752]: input attribute value: 7bit
Jun 16 14:39:32 mail postfix/smtp[2752]: smtp socket: wanted attribute: sender
Jun 16 14:39:32 mail postfix/smtp[2752]: input attribute name: sender
Jun 16 14:39:32 mail postfix/smtp[2752]: input attribute value: [email protected]
Jun 16 14:39:32 mail postfix/smtp[2752]: smtp socket: wanted attribute: envelope_id
Jun 16 14:39:32 mail postfix/smtp[2752]: input attribute name: envelope_id
Jun 16 14:39:32 mail postfix/smtp[2752]: input attribute value: (end)
Jun 16 14:39:32 mail postfix/smtp[2752]: smtp socket: wanted attribute: ret_flags
Jun 16 14:39:32 mail postfix/smtp[2752]: input attribute name: ret_flags
Jun 16 14:39:32 mail postfix/smtp[2752]: input attribute value: 0
Jun 16 14:39:32 mail postfix/smtp[2752]: smtp socket: wanted attribute: time
Jun 16 14:39:32 mail postfix/smtp[2752]: input attribute name: time
Jun 16 14:39:32 mail postfix/smtp[2752]: input attribute value: ZAa+UQAAAADSGA0AAAAAAGQGvlEAAAAAQzYNAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==
Jun 16 14:39:32 mail postfix/smtp[2752]: smtp socket: wanted attribute: log_client_name
Jun 16 14:39:32 mail postfix/smtp[2752]: input attribute name: log_client_name
Jun 16 14:39:32 mail postfix/smtp[2752]: input attribute value: localhost
Jun 16 14:39:32 mail postfix/smtp[2752]: smtp socket: wanted attribute: log_client_address
Jun 16 14:39:32 mail postfix/smtp[2752]: input attribute name: log_client_address
Jun 16 14:39:32 mail postfix/smtp[2752]: input attribute value: 127.0.0.1
Jun 16 14:39:32 mail postfix/smtp[2752]: smtp socket: wanted attribute: log_client_port
Jun 16 14:39:32 mail postfix/smtp[2752]: input attribute name: log_client_port
Jun 16 14:39:32 mail postfix/smtp[2752]: input attribute value: 46310
Jun 16 14:39:32 mail postfix/smtp[2752]: smtp socket: wanted attribute: log_protocol_name
Jun 16 14:39:32 mail postfix/smtp[2752]: input attribute name: log_protocol_name
Jun 16 14:39:32 mail postfix/smtp[2752]: input attribute value: ESMTP
Jun 16 14:39:32 mail postfix/smtp[2752]: smtp socket: wanted attribute: log_helo_name
Jun 16 14:39:32 mail postfix/smtp[2752]: input attribute name: log_helo_name
Jun 16 14:39:32 mail postfix/smtp[2752]: input attribute value: localhost
Jun 16 14:39:32 mail postfix/smtp[2752]: smtp socket: wanted attribute: sasl_method
Jun 16 14:39:32 mail postfix/smtp[2752]: input attribute name: sasl_method
Jun 16 14:39:32 mail postfix/smtp[2752]: input attribute value: (end)
Jun 16 14:39:32 mail postfix/smtp[2752]: smtp socket: wanted attribute: sasl_username
Jun 16 14:39:32 mail postfix/smtp[2752]: input attribute name: sasl_username
Jun 16 14:39:32 mail postfix/smtp[2752]: input attribute value: (end)
Jun 16 14:39:32 mail postfix/smtp[2752]: smtp socket: wanted attribute: sasl_sender
Jun 16 14:39:32 mail postfix/smtp[2752]: input attribute name: sasl_sender
Jun 16 14:39:32 mail postfix/smtp[2752]: input attribute value: (end)
Jun 16 14:39:32 mail postfix/smtp[2752]: smtp socket: wanted attribute: log_ident
Jun 16 14:39:32 mail postfix/smtp[2752]: input attribute name: log_ident
Jun 16 14:39:32 mail postfix/smtp[2752]: input attribute value: D1F5612039C
Jun 16 14:39:32 mail postfix/smtp[2752]: smtp socket: wanted attribute: rewrite_context
Jun 16 14:39:32 mail postfix/smtp[2752]: input attribute name: rewrite_context
Jun 16 14:39:32 mail postfix/smtp[2752]: input attribute value: local
Jun 16 14:39:32 mail postfix/smtp[2752]: smtp socket: wanted attribute: recipient_count
Jun 16 14:39:32 mail postfix/smtp[2752]: input attribute name: recipient_count
Jun 16 14:39:32 mail postfix/smtp[2752]: input attribute value: 1
Jun 16 14:39:32 mail postfix/smtp[2752]: smtp socket: wanted attribute: (list terminator)
Jun 16 14:39:32 mail postfix/smtp[2752]: input attribute name: (end)
Jun 16 14:39:32 mail postfix/smtp[2752]: smtp socket: wanted attribute: original_recipient
Jun 16 14:39:32 mail postfix/smtp[2752]: input attribute name: original_recipient
Jun 16 14:39:32 mail postfix/smtp[2752]: input attribute value: [email protected]
Jun 16 14:39:32 mail postfix/smtp[2752]: smtp socket: wanted attribute: recipient
Jun 16 14:39:32 mail postfix/smtp[2752]: input attribute name: recipient
Jun 16 14:39:32 mail postfix/smtp[2752]: input attribute value: [email protected]
Jun 16 14:39:32 mail postfix/smtp[2752]: smtp socket: wanted attribute: offset
Jun 16 14:39:32 mail postfix/smtp[2752]: input attribute name: offset
Jun 16 14:39:32 mail postfix/smtp[2752]: input attribute value: 604
Jun 16 14:39:32 mail postfix/smtp[2752]: smtp socket: wanted attribute: dsn_orig_rcpt
Jun 16 14:39:32 mail postfix/smtp[2752]: input attribute name: dsn_orig_rcpt
Jun 16 14:39:32 mail postfix/smtp[2752]: input attribute value: rfc822;[email protected]
Jun 16 14:39:32 mail postfix/smtp[2752]: smtp socket: wanted attribute: notify_flags
Jun 16 14:39:32 mail postfix/smtp[2752]: input attribute name: notify_flags
Jun 16 14:39:32 mail postfix/smtp[2752]: input attribute value: 0
Jun 16 14:39:32 mail postfix/smtp[2752]: smtp socket: wanted attribute: (list terminator)
Jun 16 14:39:32 mail postfix/smtp[2752]: input attribute name: (end)
Jun 16 14:39:32 mail postfix/smtp[2752]: deliver_request_get: file active/D1F5612039C
Jun 16 14:39:32 mail postfix/smtp[2752]: deliver_message: from [email protected]
Jun 16 14:39:32 mail postfix/smtp[2752]: smtp_parse_destination: ig.com.br smtp
Jun 16 14:39:32 mail postfix/smtp[2752]: connecting to ig.com.br port 25
Jun 16 14:39:32 mail amavis[1278]: (01278-01) Passed CLEAN {RelayedInternal}, LOCAL [192.168.1.22]:64368 [192.168.1.22] <[email protected]> -> <[email protected]>, Queue-ID: CD845120353, Message-ID: <[email protected]>, mail_id: xqb7Jpib5ubO, Hits: -0.999, size: 1924, queued_as: D1F5612039C, 3019 ms
**Jun 16 14:39:32 mail postfix/smtp[2747]: CD845120353: to=<[email protected]>, relay=127.0.0.1[127.0.0.1]:10024, delay=3.1, delays=0.02/0.01/0.01/3, dsn=2.0.0, status=sent (250 2.0.0 from MTA(smtp:[127.0.0.1]:10025): 250 2.0.0 Ok: queued as D1F5612039C)**
Jun 16 14:39:32 mail postfix/qmgr[2739]: CD845120353: removed

Jun 16 14:39:32 mail amavis[1278]: (01278-01) extra modules loaded: unicore/lib/Nt/De.pl, unicore/lib/Perl/SpacePer.pl
Jun 16 14:39:34 mail postfix/smtp[2752]: dns_query: ig.com.br (MX): OK
Jun 16 14:39:34 mail postfix/smtp[2752]: dns_get_answer: type MX for ig.com.br
Jun 16 14:39:34  postfix/smtp[2752]: last message repeated 6 times
Jun 16 14:39:34 mail postfix/smtp[2752]: smtp_addr_one: host ALT1.ASPMX.L.GOOGLE.COM
Jun 16 14:39:34 mail postfix/smtp[2752]: lookup ALT1.ASPMX.L.GOOGLE.COM type A flags 0
Jun 16 14:39:34 mail postfix/smtp[2752]: dns_query: ALT1.ASPMX.L.GOOGLE.COM (A): OK
Jun 16 14:39:34 mail postfix/smtp[2752]: dns_get_answer: type A for ALT1.ASPMX.L.GOOGLE.COM
Jun 16 14:39:34 mail postfix/smtp[2752]: smtp_addr_one: host ALT2.ASPMX.L.GOOGLE.COM
Jun 16 14:39:34 mail postfix/smtp[2752]: lookup ALT2.ASPMX.L.GOOGLE.COM type A flags 0
Jun 16 14:39:34 mail postfix/smtp[2752]: dns_query: ALT2.ASPMX.L.GOOGLE.COM (A): OK
Jun 16 14:39:34 mail postfix/smtp[2752]: dns_get_answer: type A for ALT2.ASPMX.L.GOOGLE.COM
Jun 16 14:39:34 mail postfix/smtp[2752]: smtp_addr_one: host ASPMX5.GOOGLEMAIL.COM
Jun 16 14:39:34 mail postfix/smtp[2752]: lookup ASPMX5.GOOGLEMAIL.COM type A flags 0
Jun 16 14:39:35 mail postfix/smtp[2752]: dns_query: ASPMX5.GOOGLEMAIL.COM (A): OK
Jun 16 14:39:35 mail postfix/smtp[2752]: dns_get_answer: type A for ASPMX5.GOOGLEMAIL.COM
Jun 16 14:39:35 mail postfix/smtp[2752]: smtp_addr_one: host ASPMX2.GOOGLEMAIL.COM
Jun 16 14:39:35 mail postfix/smtp[2752]: lookup ASPMX2.GOOGLEMAIL.COM type A flags 0
Jun 16 14:39:35 mail postfix/smtp[2752]: dns_query: ASPMX2.GOOGLEMAIL.COM (A): OK
Jun 16 14:39:35 mail postfix/smtp[2752]: dns_get_answer: type A for ASPMX2.GOOGLEMAIL.COM
Jun 16 14:39:35 mail postfix/smtp[2752]: smtp_addr_one: host ASPMX3.GOOGLEMAIL.COM
Jun 16 14:39:35 mail postfix/smtp[2752]: lookup ASPMX3.GOOGLEMAIL.COM type A flags 0
Jun 16 14:39:35 mail postfix/smtp[2752]: dns_query: ASPMX3.GOOGLEMAIL.COM (A): OK
Jun 16 14:39:35 mail postfix/smtp[2752]: dns_get_answer: type A for ASPMX3.GOOGLEMAIL.COM
Jun 16 14:39:35 mail postfix/smtp[2752]: smtp_addr_one: host ASPMX4.GOOGLEMAIL.COM
Jun 16 14:39:35 mail postfix/smtp[2752]: lookup ASPMX4.GOOGLEMAIL.COM type A flags 0
Jun 16 14:39:35 mail postfix/smtp[2752]: dns_query: ASPMX4.GOOGLEMAIL.COM (A): OK
Jun 16 14:39:35 mail postfix/smtp[2752]: dns_get_answer: type A for ASPMX4.GOOGLEMAIL.COM
Jun 16 14:39:35 mail postfix/smtp[2752]: smtp_addr_one: host ASPMX.L.GOOGLE.COM
Jun 16 14:39:35 mail postfix/smtp[2752]: lookup ASPMX.L.GOOGLE.COM type A flags 0
Jun 16 14:39:35 mail postfix/smtp[2752]: dns_query: ASPMX.L.GOOGLE.COM (A): OK
Jun 16 14:39:35 mail postfix/smtp[2752]: dns_get_answer: type A for ASPMX.L.GOOGLE.COM
Jun 16 14:39:35 mail postfix/smtp[2752]: begin ig.com.br address list
Jun 16 14:39:35 mail postfix/smtp[2752]: pref    5 host ALT1.ASPMX.L.GOOGLE.COM/173.194.74.26
Jun 16 14:39:35 mail postfix/smtp[2752]: pref    5 host ALT2.ASPMX.L.GOOGLE.COM/173.194.75.26
Jun 16 14:39:35 mail postfix/smtp[2752]: pref   10 host ASPMX5.GOOGLEMAIL.COM/74.125.136.26
Jun 16 14:39:35 mail postfix/smtp[2752]: pref   10 host ASPMX2.GOOGLEMAIL.COM/173.194.74.27
Jun 16 14:39:35 mail postfix/smtp[2752]: pref   10 host ASPMX3.GOOGLEMAIL.COM/173.194.75.27
Jun 16 14:39:35 mail postfix/smtp[2752]: pref   10 host ASPMX4.GOOGLEMAIL.COM/173.194.66.27
Jun 16 14:39:35 mail postfix/smtp[2752]: pref   20 host ASPMX.L.GOOGLE.COM/74.125.142.27
Jun 16 14:39:35 mail postfix/smtp[2752]: end ig.com.br address list
Jun 16 14:39:35 mail postfix/smtp[2752]: smtp_find_self: not found
Jun 16 14:39:35 mail postfix/smtp[2752]: smtp_connect_addr: trying: ALT1.ASPMX.L.GOOGLE.COM[173.194.74.26] port 25...
Jun 16 14:39:35 mail postfix/smtp[2752]: vstream_tweak_tcp: TCP_MAXSEG 1448
Jun 16 14:39:35 mail postfix/smtp[2752]: global TLS level: may
Jun 16 14:39:35 mail postfix/smtp[2752]: smtp_stream_setup: maxtime=300 enable_deadline=0
Jun 16 14:39:35 mail postfix/smtpd[2753]: connect from unknown[192.168.1.2]
Jun 16 14:39:35 mail postfix/smtp[2752]: < ALT1.ASPMX.L.GOOGLE.COM[173.194.74.26]:25: 220 mail.thegeekbeaver.ca ESMTP Postfix
Jun 16 14:39:35 mail postfix/smtp[2752]: warning: host ALT1.ASPMX.L.GOOGLE.COM[173.194.74.26]:25 greeted me with my own hostname mail.thegeekbeaver.ca
Jun 16 14:39:35 mail postfix/smtp[2752]: > ALT1.ASPMX.L.GOOGLE.COM[173.194.74.26]:25: EHLO mail.thegeekbeaver.ca
Jun 16 14:39:35 mail postfix/smtp[2752]: < ALT1.ASPMX.L.GOOGLE.COM[173.194.74.26]:25: 250-mail.thegeekbeaver.ca
Jun 16 14:39:35 mail postfix/smtp[2752]: < ALT1.ASPMX.L.GOOGLE.COM[173.194.74.26]:25: 250-PIPELINING
Jun 16 14:39:35 mail postfix/smtp[2752]: < ALT1.ASPMX.L.GOOGLE.COM[173.194.74.26]:25: 250-SIZE
Jun 16 14:39:35 mail postfix/smtp[2752]: < ALT1.ASPMX.L.GOOGLE.COM[173.194.74.26]:25: 250-ETRN
Jun 16 14:39:35 mail postfix/smtp[2752]: < ALT1.ASPMX.L.GOOGLE.COM[173.194.74.26]:25: 250-STARTTLS
Jun 16 14:39:35 mail postfix/smtp[2752]: < ALT1.ASPMX.L.GOOGLE.COM[173.194.74.26]:25: 250-AUTH PLAIN LOGIN
Jun 16 14:39:35 mail postfix/smtp[2752]: < ALT1.ASPMX.L.GOOGLE.COM[173.194.74.26]:25: 250-AUTH=PLAIN LOGIN
Jun 16 14:39:35 mail postfix/smtp[2752]: < ALT1.ASPMX.L.GOOGLE.COM[173.194.74.26]:25: 250-ENHANCEDSTATUSCODES
Jun 16 14:39:35 mail postfix/smtp[2752]: < ALT1.ASPMX.L.GOOGLE.COM[173.194.74.26]:25: 250-8BITMIME
Jun 16 14:39:35 mail postfix/smtp[2752]: < ALT1.ASPMX.L.GOOGLE.COM[173.194.74.26]:25: 250 DSN
Jun 16 14:39:35 mail postfix/smtp[2752]: warning: host ALT1.ASPMX.L.GOOGLE.COM[173.194.74.26]:25 replied to HELO/EHLO with my own hostname mail.thegeekbeaver.ca
Jun 16 14:39:35 mail postfix/smtp[2752]: connect to subsystem private/bounce
Jun 16 14:39:35 mail postfix/smtp[2752]: send attr nrequest = 0
Jun 16 14:39:35 mail postfix/smtp[2752]: send attr flags = 0
Jun 16 14:39:35 mail postfix/smtp[2752]: send attr queue_id = D1F5612039C
Jun 16 14:39:35 mail postfix/smtp[2752]: send attr original_recipient = [email protected]
Jun 16 14:39:35 mail postfix/smtp[2752]: send attr recipient = [email protected]
Jun 16 14:39:35 mail postfix/smtp[2752]: send attr offset = 604
Jun 16 14:39:35 mail postfix/smtp[2752]: send attr dsn_orig_rcpt = rfc822;[email protected]
Jun 16 14:39:35 mail postfix/smtp[2752]: send attr notify_flags = 0
Jun 16 14:39:35 mail postfix/smtp[2752]: send attr status = 5.4.6
Jun 16 14:39:35 mail postfix/smtpd[2753]: disconnect from unknown[192.168.1.2]
Jun 16 14:39:35 mail postfix/cleanup[2746]: 31D0212039E: message-id=<[email protected]>
Jun 16 14:39:35 mail postfix/bounce[2754]: D1F5612039C: sender non-delivery notification: 31D0212039E
Jun 16 14:39:35 mail postfix/qmgr[2739]: 31D0212039E: from=<>, size=4315, nrcpt=1 (queue active)
Jun 16 14:39:35 mail postfix/qmgr[2739]: D1F5612039C: removed
Jun 16 14:39:35 mail postfix/virtual[2755]: 31D0212039E: to=<[email protected]>, relay=virtual, delay=0.02, delays=0/0.01/0/0.01, dsn=2.0.0, status=sent (delivered to maildir)
Jun 16 14:39:35 mail postfix/qmgr[2739]: 31D0212039E: removed

获取发送状态及日志中删除的行后,系统开始获取环回邮件。

这是我的 main.cf

proxy_interfaces=24.137.51.30
myorigin = /etc/mailname
mydomain = thegeekbeaver.ca
smtpd_banner = $myhostname ESMTP $mail_name
biff = no
append_dot_mydomain = no
readme_directory = no
mydestination =
relayhost =
mynetworks = 192.168.1.0/24 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mynetworks_style = host
mailbox_size_limit = 0
virtual_mailbox_limit = 0
recipient_delimiter = +
inet_interfaces = all
inet_protocols = ipv4
message_size_limit = 0

# SMTP Authentication (SASL)

smtpd_sasl_auth_enable = yes
broken_sasl_auth_clients = yes
smtpd_sasl_security_options = noanonymous
smtpd_sasl_local_domain = $mydomain

# Encrypted transfer (SSL/TLS)

smtp_use_tls = yes
smtpd_use_tls = yes
smtpd_tls_cert_file = /etc/ssl/private/mail.thegeekbeaver.ca.crt
smtpd_tls_key_file = /etc/ssl/private/mail.thegeekbeaver.ca.key
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache

# Basic SPAM prevention

#smtpd_helo_required = yes
#smtpd_delay_reject = yes
disable_vrfy_command = yes
smtpd_sender_restrictions = permit_sasl_authenticated, permit_mynetworks, reject_unknown_sender_domain, reject_unauth_destination
smtpd_recipient_restrictions =  permit_sasl_authenticated, permit_mynetworks, reject_unknown_sender_domain, reject_unauth_destination

# Force incoming mail to go through Amavis

content_filter = amavis:[127.0.0.1]:10024
receive_override_options = no_address_mappings

# Virtual user mappings

alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
virtual_mailbox_base = /var/spool/mail/virtual
virtual_mailbox_maps = mysql:/etc/postfix/maps/user.cf
virtual_uid_maps = static:5000
virtual_gid_maps =  static:5000
virtual_alias_maps = mysql:/etc/postfix/maps/alias.cf
virtual_mailbox_domains = mysql:/etc/postfix/maps/domain.cf

域名在 mysql 数据库中配置。对于域名,我有以下几行:

+-----------------------+-----------+---------+
| domain                | transport | enabled |
+-----------------------+-----------+---------+
| mail.thegeekbeaver.ca | virtual:  |       1 |
| thegeekbeaver.ca      | virtual:  |       1 |
+-----------------------+-----------+---------+

我还有一个内部 DNS。DNS 服务器是我的服务器托管的另一台虚拟机。我的 DNS 服务器的 IP 是 192.168.1.3。它负责翻译内部名称。如果无法翻译,它会转发到我的 ISP DNS。

以下是我从 Gmail 收到的消息示例

     This is the mail system at host mail.localdomain.

I'm sorry to have to inform you that your message could not
be delivered to one or more recipients. It's attached below.

For further assistance, please send mail to postmaster.

If you do so, please include this problem report. You can
delete your own text from the attached returned message.

                  The mail system

<[email protected]>: mail for gmail.com loops back to myself
Reporting-MTA: dns; mail.localdomain
X-Postfix-Queue-ID: 7199212037D
X-Postfix-Sender: rfc822; [email protected]
Arrival-Date: Sun, 16 Jun 2013 11:00:35 -0400 (EDT)

Final-Recipient: rfc822; [email protected]
Original-Recipient: rfc822;[email protected]
Action: failed
Status: 5.4.6
Diagnostic-Code: X-Postfix; mail for gmail.com loops back to myself

看一下Diagnostic-Code: X-Postfix;。它没有告诉内部电子邮件。它告诉我 gmail 回送了我的电子邮件。

这些是我的 iptables 规则:

#Allowing Established Sessions
iptables -A INPUT -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
#connections from inside network
iptables -A INPUT -i lo -j ACCEPT
iptables -A INPUT -i p3p1 -j ACCEPT
iptables -I INPUT -p tcp --dport 25 -j ACCEPT
iptables -I INPUT -p tcp --dport 143 -j ACCEPT
iptables -I INPUT -p tcp --dport 110 -j ACCEPT
iptables -I OUTPUT -p tcp --dport 53 -j ACCEPT
iptables -I OUTPUT -p udp --dport 53 -j ACCEPT

iptables -A OUTPUT -p tcp --sport 25 -m state --state ESTABLISHED -j ACCEPT
iptables -A OUTPUT -p tcp --sport 143 -m state --state ESTABLISHED -j ACCEPT
iptables -A OUTPUT -p tcp --sport 110 -m state --state ESTABLISHED -j ACCEPT

#PREROUTING

iptables -t nat -A POSTROUTING -j MASQUERADE

iptables -t nat -A PREROUTING -p tcp --dport 25 -j DNAT --to 192.168.1.4:25
iptables -t nat -A PREROUTING -p tcp --dport 143 -j DNAT --to 192.168.1.4:143
iptables -t nat -A PREROUTING -p tcp --dport 110 -j DNAT --to 192.168.1.4:110

iptables -A FORWARD -i p2p1 -p tcp --dport 25 -d 192.168.1.4
iptables -A FORWARD -i p2p1 -p tcp --dport 143 -d 192.168.1.4
iptables -A FORWARD -i p2p1 -p tcp --dport 110 -d 192.168.1.4
iptables -A FORWARD -i p2p1 -p tcp --dport 53 -d 192.168.1.3
iptables -A FORWARD -i p2p1 -p udp --dport 53 -d 192.168.1.3

#iptables -A FORWARD -j DROP
iptables -A INPUT -j DROP

我相信这就是我所掌握的所有细节。我相信你会尽力帮助我。但是,请相信这不是 mydestination 的问题。请不要回答我说我必须使用 mydestination 值。问题不在于此。我确定。当错误与 mydestination 值有关时,后缀诊断代码显示内部域。此外,这不是备份电子邮件。它不是中继服务器。它是主邮件服务器。当我有动态 IP 时,相同的配置工作正常。当我将其迁移到静态解决方案时,它停止工作。

我的问题是,为什么外部电子邮件已经发送,但提供商却拒绝它并循环回到我的邮件服务器?

答案1

问题不在于外部提供商拒绝你的邮件,而在于你使用iptables拦截全部在端口 25 上传出流量,然后将该流量重定向回192.168.1.4:25当然是您的 postfix 安装。

这就是为什么你会收到错误邮件循环回到自身的原因,因为它是字面上地循环回到自身。

答案2

我通过以下做法在这里定居下来:

iptables -t nat -A PREROUTING -p tcp -i eth0 -d 177.53.80.39 -dport 25 -j DNAT -to-destination 192.168.0.111:25

相关内容