我最近开始在我的postfix服务器上configuration地址,并且偶然发现了一个与我的同事有关的问题。
所以假设我有一个别名[email protected]
将邮件转发到[email protected]和[email protected]
如果我们发送到相同的域名,别名是,一切正常,电子邮件是delievered,但让我们深入挖掘其他域的问题,因为电子邮件立即反弹与这个错误:
<[email protected]> (expanded from <[email protected]>): host mx.foo.net[144.76.75.247] said: 550 You must be authenticated (in reply to RCPT TO command)
幸运的是,这个其他领域的老板是我的同事,所以我先向他们提出这个问题。 我们做了一些挖掘并计算出来,这封电子邮件不仅仅是发自[email protected],而是发送给其他人。
为了更好的理解这个问题,我build议你看一看邮件头文件[email protected],这个文件被foo.net服务器拒绝。
Delivered-To: [email protected] Received: by 10.140.108.54 with SMTP id i51csp86667qgf; Thu, 24 Apr 2014 04:54:02 -0700 (PDT) X-Received: by 10.14.246.1 with SMTP id p1mr2029071eer.20.1398340441786; Thu, 24 Apr 2014 04:54:01 -0700 (PDT) Return-Path: <[email protected]> Received: from bar.ru (bar.ru. [47.175.193.55]) by mx.google.com with ESMTPS id p8si7998323eew.276.2014.04.24.04.54.01 for <[email protected]> (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 24 Apr 2014 04:54:01 -0700 (PDT) Received-SPF: fail (google.com: domain of [email protected] does not designate 47.175.193.55 as permitted sender) client-ip=47.175.193.55; Authentication-Results: mx.google.com; spf=hardfail (google.com: domain of [email protected] does not designate 47.175.193.55 as permitted sender) [email protected]; dkim=pass [email protected] Received: from mx.foo.net (mx.foo.net [144.76.75.247]) by bar.ru (Postfix) with ESMTPS id BC4E9BC0031 for <[email protected]>; Thu, 24 Apr 2014 15:54:00 +0400 (MSK) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=foo.net; s=default; h=Content-Transfer-Encoding:Content-Type:Subject:To:MIME-Version:From:Date:Message-ID; bh=Sr6qzI6M/AdTYgu33PjdinGA745C3GUCsXevUC1TgDI=; b=DpO1qnFhn+Srhuuj+2bzi4bUOoMOAr4tSRqK/sbz0gt5Ogp+RK9BJQTpix5oPoebo7M7MYIV+zHlzTdJnpPa0FSa4WTewvYxOE81CX/+k/VLQdK1SPcbdPSRACzKsS3Jq7QE9XKK1maW8s0syGbToGT/KNXHkeBKtP6QhIrUs3Y4=; Envelope-to: [email protected] Delivery-date: Thu, 24 Apr 2014 13:54:00 +0200 Message-ID: <[email protected]> Date: Thu, 24 Apr 2014 14:53:54 +0300 From: Vitali R <[email protected]> User-Agent: Mozilla/5.0 (X11; Linux i686; rv:16.0) Gecko/20121028 Thunderbird/16.0.2 MIME-Version: 1.0 To: [email protected] Subject: hello world this is alias test Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit testest
为更好的理解图片: http : //i.imgur.com/XAVZY5L.png所以有趣的部分是这一行
Received-SPF: fail (google.com: domain of [email protected] does not designate 47.175.193.55 as permitted sender) client-ip=47.175.193.55;
而他将是正确的,11.111.111.11确实不指定给otherdomain.com,因为47.175.193.55是通过其发送电子邮件的服务器的IP(通过别名)。
简而言之,服务器模拟自己的电子邮件是从[email protected]发送的,而实际上它是从bar.ru发送的,而我的同事服务器因此拒绝了一封信。
我明白这可能看起来很混乱,但看到这样。 你可以给任何一个服务器发送一封信,告诉服务器你从一封电子邮件中发送了这封信,显然你没有权限。 这几乎是在别名问题发生在这里。
你会如何回应这种问题,你认为在这里拒绝电子邮件是适当的吗?
感谢您的帮助。
postfix接收邮件并将其转发到别名的方式是完全正确的。 当然,由于发件人来自外部域,并且您已经为外部域创build了别名,因此接收服务器将会注意到您确实不应该从您不负责的域发送邮件。 一些服务器反对将邮件发送给他们,声称来自他们负责的域名。 这不是不合理的,现在发送的垃圾邮件数量可能更加明智。
有多种方法可以解决这个问题。
不要在您不负责的域中使用电子邮件创build别名。 这是限制,但解决问题的最简单的方法。
使用smtp_generic_maps ,这将需要创build条目来映射错误的地址到一个正确的地址,例如[email protected] [email protected] ,当然,这将需要一个条目,每个电子邮件,你想映射,一个通用的电子邮件你不知道: @foo.net [email protected]将重写任何@foo.net地址[email protected] ,除了[email protected] 。 这有消除原始发件人的副作用。如果您想回复发送原始邮件的人,这不是很好。
如果别名发送到的服务器是您的帐户, sender_dependent_relayhost_maps可能是一个有效的解决scheme,因为它允许postfix在这种情况下提供远程服务器要求的身份validation。 缺点:只有当发件人是在地图上configuration的发件人时才提供validation,当然,这只会解决单个服务器的问题。 如果你只有这样的情况的几个例子,它可能是最好的方式去做,但是..