大网数据广告活动
服务器运维问答

Postfix alias and "impersonating" issue

· 52CE 我爱测

I recently started configuring addresses on my postfix server and stumbled into an issue with my colleagues. So assume i have an alias [email omitted] which forwards mail to [email omitted] and [email omitted] In case we send to …

问题原文

原帖链接 · Screatch · CC BY-SA 4.0

I recently started configuring addresses on my postfix server and stumbled into an issue with my colleagues.

So assume i have an alias [email omitted]

which forwards mail to [email omitted] and [email omitted]

In case we send to the same domain, the alias is, everything works perfectly well and email is delievered, but lets dig deeper into otherdomain issue as email immediately bounces back with this error:

<[email omitted]> (expanded from <[email omitted]>): host
mx.foo.net[144.76.75.247] said: 550 You must be authenticated (in
reply to RCPT TO command)

Fortunately, owners of this otherdomain are my colleagues, so I addressed this question to them first. We did some digging and figured it out, that email is not just simply sent from [email omitted], but rather is sent impersonating some one else.

To get a better understanding in this issue, I advise you to take a look at the headers of delivered email to [email omitted], that is rejected by foo.net server.

Delivered-To: [email omitted]
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 omitted]>
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 omitted]>
        (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 omitted] 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 omitted] does not designate 47.175.193.55 as permitted sender) smtp.mail=[email omitted];
       dkim=pass header.i=@foo.net
Received: from mx.foo.net (mx.foo.net [144.76.75.247])
    by bar.ru (Postfix) with ESMTPS id BC4E9BC0031
    for <[email omitted]>; 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 omitted]
Delivery-date: Thu, 24 Apr 2014 13:54:00 +0200
Message-ID: <[email omitted]>
Date: Thu, 24 Apr 2014 14:53:54 +0300
From: Vitali R <[email omitted]>
User-Agent: Mozilla/5.0 (X11; Linux i686; rv:16.0) Gecko/20121028 Thunderbird/16.0.2
MIME-Version: 1.0
To: [email omitted]
Subject: hello world this is alias test
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

testest

Image for better understanding: So the interesting part is this line

Received-SPF: fail (google.com: domain of [email omitted] does not designate 47.175.193.55 as permitted sender) client-ip=47.175.193.55;

And he will be correct, 11.111.111.11 indeed does not designate to otherdomain.com, as 47.175.193.55 is the IP of server, through which the email was sent (via alias).

So simply speaking, server impersonates itself that email is sent from [email omitted], while in reality it was sent from bar.ru and my colleague server rejects a letter because of that.

I understand this may seem confusing but see at this way. You can send a letter to pretty much any server, telling server that you sent it from an email, that you clearly do not has access to. This is pretty much what happens with alias issue here.

How would you react to this kind of issue and do you think that rejecting email is appropriate here?

已采纳解答

原帖链接 · NickW · CC BY-SA 3.0

The way that postfix is receiving the mail and forwarding it to the aliases is completely correct. Of course, since the sender is from an external domain, and you have created an alias to an external domain, the receiving server will note that you really shouldn't be sending mail from a domain which you are not responsible for. Some servers object to mail being sent to them, claiming to come from a domain for which they are responsible. This isn't unreasonable, and given the amount of spam sent nowadays maybe even wise.

There are multiple ways to resolve this.

  1. Don't create aliases with emails in domains you aren't responsible for. It's limiting, but the simplest way to resolve the issue.

  2. Use smtp_generic_maps, this will require creating entries to map the wrong address to a correct address, for example [email omitted] [email omitted], of course, this will require an entry for each email you want to map, and a generic one for emails you don't know: @foo.net [email omitted] will rewrite any @foo.net address to [email omitted], except [email omitted]. This has the side effect of eliminating the original sender.. which isn't great, if you'd like to reply to the person who sent the original message.

  3. If the server that the alias is being sent to is your account, sender_dependent_relayhost_maps could be a valid solution, as it allows postfix to provide the authentication the remote server asks for in that case. Shortcomings: it will only provide authentication when the sender is the one configured in the map, and of course, it will only resolve the issue of that single server. If you only have a few examples of situations like this, it might be the best way of going about it however..

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2014-04-24)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0 / CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。