當使用 ESMTP 標頭發送原始電子郵件時,透過 IMAP 從我們的郵箱匯入郵件時,Gmail SPF 檢查失敗

當使用 ESMTP 標頭發送原始電子郵件時,透過 IMAP 從我們的郵箱匯入郵件時,Gmail SPF 檢查失敗

我們遇到了一個奇怪的情況:

  • 我們收到一封包含 ESMTP 標頭的電子郵件
  • 我們的伺服器接受它,沒問題
  • 我們將該郵件匯入 Gmail,就像我們郵箱中的任何其他電子郵件一樣
  • Gmail 進行 SPF 檢查,但失敗
  • Gmail 使用我們的伺服器 IP 位址和郵件寄件者網域來進行檢查(原文如此!)

我們在本機信箱之間的郵件也有類似的問題(但 Gmail 使用我們的伺服器網域和用戶端的 IP):當透過 SMTP 從一個本機信箱傳送到另一個本機信箱時,匯入到 Gmail 的電子郵件的 SPF 會失敗,因為郵件中的用戶端 IP 而不是伺服器 IP

例子:

Received-SPF: fail (google.com: domain of [email protected] does not designate 188.40.153.39 as permitted sender) client-ip=188.40.153.39;
Authentication-Results: mx.google.com;
   spf=fail (google.com: domain of [email protected] does not designate 188.40.153.39 as permitted sender) [email protected]

更多標題:

Delivered-To: [email protected]
Received: by 10.194.168.164 with SMTP id zx4csp522020wjb;
    Thu, 19 Feb 2015 06:26:04 -0800 (PST)
X-Received: by 10.180.219.66 with SMTP id pm2mr10333511wic.91.1424355964017;
    Thu, 19 Feb 2015 06:26:04 -0800 (PST)
Return-Path: <[email protected]>
Received: from server.webvizarts.com  (server.webvizarts.com . [188.40.153.39])
    by mx.google.com with ESMTPS id ge6si41332059wjd.24.2015.02.19.06.26.03
    for <[email protected]>
    (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
    Thu, 19 Feb 2015 06:26:04 -0800 (PST)
Received-SPF: fail (google.com: domain of [email protected] does not designate 188.40.153.39 as permitted sender) client-ip=188.40.153.39;
Authentication-Results: mx.google.com;
   spf=fail (google.com: domain of [email protected] does not designate 188.40.153.39 as permitted sender) [email protected]
Received: from mx.msit.gov.pl ([77.252.152.34])
    by server.webvizarts.com  with esmtp (Exim 4.83)
    (envelope-from <[email protected]>)
    id 1YOS3G-0003eP-T2
    for [email protected]; Thu, 19 Feb 2015 15:26:03 +0100
Received: from msit.gov.pl (unknown [192.168.10.30])
    by mx.msit.gov.pl (Postfix) with ESMTPS id 5BE2F3B64
    for <[email protected]>; Thu, 19 Feb 2015 15:24:48 +0100 (CET)
Received: from EX3.sport.local (192.168.10.30) by EX3.sport.local
 (192.168.10.30) with Microsoft SMTP Server (TLS) id 15.0.1044.25; Thu, 19 Feb
 2015 15:22:45 +0100
Received: from EX3.sport.local ([fe80::b8ed:df29:c87:77d2]) by EX3.sport.local
 ([fe80::b8ed:df29:c87:77d2%15]) with mapi id 15.00.1044.021; Thu, 19 Feb 2015
 15:22:45 +0100
From: John Smith <[email protected]>
To: Christopher Smith <[email protected]>
Subject: Re: Some sensitive subject
Thread-Topic: Some sensitive subject
X-MS-Has-Attach: yes
X-MS-TNEF-Correlator:
x-ms-exchange-transport-fromentityheader: Hosted
x-originating-ip: [192.168.0.102]

隱藏標題、信箱名稱和人員姓名。

我們在基於 Debian 的 VPS 上有 dovecot+exim。

我們尋找一些解決方案來避免這種情況。 Gmail 方面的實施是否有缺陷,或者我們可以採取措施嗎?

編輯:根據評論,轉發被錯誤地視為導入

答案1

[...]
我們將該郵件匯入 Gmail,就像我們郵箱中的任何其他電子郵件一樣
[...]

這是錯誤的,因為郵件標頭的意思有所不同:

Received: from server.webvizarts.com  (server.webvizarts.com . [188.40.153.39])
    by mx.google.com with ESMTPS id ge6si41332059wjd.24.2015.02.19.06.26.03
    for <[email protected]>
    (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
    Thu, 19 Feb 2015 06:26:04 -0800 (PST)

電子郵件由server.webvizarts.comto mx.google.comfor轉寄[email protected]。顯然沒有設定信封-from:

Authentication-Results: mx.google.com;
   spf=fail (google.com: domain of [email protected] does not designate 188.40.153.39 as permitted sender) [email protected]

顯然,信封的寄件人仍然是[email protected]

我可以想到你在這裡有三個選擇:

  1. 使用以下命令重寫信封-from寄件者重寫方案例如與後綴-srsd
  2. 在發送/轉發之前,在 Gmail 中進行身份驗證
  3. 將電子郵件從您的伺服器推送到 Gmail 的 IMAP/POP3 郵箱或讓它們透過 Gmail 從您的伺服器拉取(我不知道哪個更容易)

相關內容