iRedMail:網域別名不適用於某些外部郵件(變音符號/punycode)

iRedMail:網域別名不適用於某些外部郵件(變音符號/punycode)

為我的主網域成功設定 iRedMail 伺服器後,我嘗試按照此處的步驟將輔助網域新增為別名:https://docs.iredmail.org/sql.add.alias.domain.html

這還沒有達到目的,所以我另外將輔助域加入到 /etc/postfix/main.cf 中:

virtual_alias_domains = domain2.tld
virtual_alias_maps = hash:/etc/postfix/virtual

注意:我沒有刪除 virtual_alias_maps 下的任何現有 mysql 條目。

並將映射輸入到 /etc/postfix/virtual 中,然後執行「postmap /etc/postfix/virtual」:

@domain2.tld     @domain1.tld

這是在伺服器內部工作的。[電子郵件受保護]可以發送至[電子郵件受保護]user2將在他的信箱中收到郵件。外部電子郵件在發送至[電子郵件受保護]

不幸的是,它不適用於發送到輔助網域的外部郵件。在我的 /var/logs/mail.log 中,我找到以下幾行:

postfix/smtpd[5541]: NOQUEUE: reject: RCPT from mail-oi1-x231.google.com[2607:f8b0:4864:20::231]: 451 4.3.5 <[email protected]>: Recipient address rejected: Server configuration problem; from=<[email protected]> to=<[email protected]> proto=ESMTP helo=<mail-oi1-x231.google.com>

和:

postfix/smtpd[5644]: warning: problem talking to server 127.0.0.1:12340: Connection timed out

在連接埠 12340 dovecot 正在偵聽:

dovecot    513      root   67u  IPv4  17087      0t0  TCP 127.0.0.1:12340 (LISTEN)

在我的鴿舍日誌中,我反覆發現以下行:

dovecot: quota-status: Error: quota-status: Client sent invalid recipient address: Invalid character in path

在對不同的外部郵件託管商進行一些進一步測試後,我意識到四分之二的郵件在發送到輔助網域時到達。 GMail 和 Hotmail 沒有,我公司的 Exchange 和其他一些網路供應商可以通過。

這就是我被困的地方。我懷疑以下兩件事之一:要么我只是錯過了必要的配置,這似乎很有可能,因為我以前從未在 Debian 上設置過郵件伺服器,要么 dovecot 錯誤是由我的輔助域引起的。輔助域包含變音符號 (ä/ö/ü),我很清楚這可能會導致一些問題。因此,我也擁有 punycode 格式變體的網域。因此,每當我將帶有元音變音的輔助域添加到配置中時,我也會添加它的 punnycode 版本,假設它可以解決這方面的任何問題。

iRedMail/postfix/dovecot/whateverelseisinvolved 似乎與 punnycode/umlauts 本身運作得很好,它似乎只取決於寄件人,因為只有一半的郵件遺失(寄件者不會收到錯誤)。任何猜測為什麼或我可以檢查哪些日誌來更深入地研究這個問題?我是否只是錯過了配置一些明顯的東西?

任何朝著正確方向的推動都會受到高度讚賞。

問候,鼻涕

====基本資訊====

  • iRedMail版本:1.4.0 MARIADB版
  • Linux/BSD 發行版名稱與版本:Debian GNU/Linux 10 (buster) - 10.10
  • 使用的資料庫:MySQL(MariaDB)
  • 網路伺服器:Nginx

====編輯====

就基本設定而言;全新安裝 Debian 10 後,我按照本指南中的步驟操作https://www.linuxbabe.com/mail-server/debian-10-buster-iredmail-email-server

帖子中提到了指南中更改的任何特定配置。我還頒發了一個證書,其中包括 punnycode 中的主網域和輔助網域。

這是啟動時的各種日誌:

/var/log/mail.log:

Aug 14 14:24:36 s postfix/postfix-script[1637]: warning: symlink leaves directory: /etc/postfix/./makedefs.out
Aug 14 14:24:37 s amavis[573]: starting. /usr/sbin/amavisd-new at host.domain1.tld amavisd-new-2.11.0 (20160426), Unicode aware, LC_ALL="C", LANG="en_US.UTF-8"
Aug 14 14:24:37 s postfix/postfix-script[1819]: starting the Postfix mail system
Aug 14 14:24:37 s postfix/master[1821]: daemon started -- version 3.4.14, configuration /etc/postfix
Aug 14 14:24:39 s amavis[1915]: Net::Server: Group Not Defined.  Defaulting to EGID '121 121'
Aug 14 14:24:39 s amavis[1915]: Net::Server: User Not Defined.  Defaulting to EUID '113'
Aug 14 14:24:39 s amavis[1915]: No ext program for   .F, tried: unfreeze, freeze -d, melt, fcat
Aug 14 14:24:39 s amavis[1915]: No ext program for   .zoo, tried: zoo, unzoo
Aug 14 14:24:39 s amavis[1915]: No decoder for       .F   
Aug 14 14:24:39 s amavis[1915]: No decoder for       .zoo 
Aug 14 14:24:39 s amavis[1915]: Using primary internal av scanner code for clamav-socket
Aug 14 14:24:39 s amavis[1915]: Found secondary av scanner clamav-clamscan at /usr/bin/clamscan

/var/log/dovecot/dovecot.log:

Aug 14 14:24:26 s dovecot: master: Dovecot v2.3.4.1 (f79e8e7e4) starting up for pop3, imap, sieve, lmtp (core dumps disabled)
Aug 14 14:24:43 s dovecot: stats: Error: (stats-reader): didn't reply with a valid VERSION line: EXPORT#011global
Aug 14 14:24:43 s dovecot: stats: Error: (stats-reader): didn't reply with a valid VERSION line: EXPORT#011global

grep postfix /var/log/syslog:

Aug 14 14:24:36 s postfix/postfix-script[1637]: warning: symlink leaves directory: /etc/postfix/./makedefs.out
Aug 14 14:24:37 s postfix/postfix-script[1819]: starting the Postfix mail system
Aug 14 14:24:37 s postfix/master[1821]: daemon started -- version 3.4.14, configuration /etc/postfix

我在我的 postfix main.cf 中禁用了配額功能並啟用了 SMTPUTF8,除了 mail.log 中啟動時的附加行之外,沒有顯著的變化:

Aug 14 14:59:46 s amavis[571]: starting. /usr/sbin/amavisd-new at host.domain1.tld amavisd-new-2.11.0 (20160426), Unicode aware, LC_ALL="C", LANG="en_US.UTF-8"

不幸的是,行為仍然相同。在進一步分析日誌後,我意識到來自提供者的郵件似乎是透過 punycode 發送的(即使我專門將其發送到帶有元音變音/非 ASCII 字元的網域)。另一方面,GMail 實際上將郵件發送到包含元音變音的網域(非 punycode,即使我在收件者郵件地址中專門使用 punycode 格式)。因此,我要么需要教我的伺服器處理非 ASCII 字符,要么需要教 Google 透過 punycode 發送。或教我的伺服器將元音變音轉換為 punycode。選項 2 顯然不是真正的選項,所以選項 1 或 3 是。

來自非 GMail 託管郵件的 mail.log 條目:

postfix/amavis/smtp[2300]: 4Gn0zh0z4FzLnSJ: to=<[email protected]>, orig_to=<[email protected]>, relay=127.0.0.1[127.0.0.1]:10024, delay=4, delays=0.1/0/0.01/3.9, 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 4Gn0zm04JHzLxc0)

來自 GMail 郵件的 mail.log 條目:

Aug 14 15:06:44 s postfix/smtpd[2281]: warning: problem talking to server 127.0.0.1:12340: Connection timed out
Aug 14 15:06:44 s postfix/smtpd[2281]: NOQUEUE: reject: RCPT from mail-ot1-x32b.google.com[2607:f8b0:4864:20::32b]: 451 4.3.5 <user@dömain2.tld>: Recipient address rejected: Server configuration problem; from=<[email protected]> to=<user@dömain2.tld> proto=ESMTP helo=<mail-ot1-x32b.google.com>

答案1

由於我仍然看不到完整的解決方案(Postfix 中的地址重寫可能有效,但這將是這個故事的悲傷結局),我正在答案中收集我的診斷步驟:

  • 獲得有效的配置,例如透過命令轉儲postfix -n以及postfix -M郵件伺服器是否確保清楚地了解不同服務(主要是amavis)的整合方式。

  • 單獨測試本地部分、非地址標頭和網域中的非 ASCII(有透過 Punycode 編碼的 A 標籤,以 開頭xn--,以及直接包含非 ASCII 字母的 Unicode)

  • 在 Postfix 中保持SMTPUTF8停用狀態 - Dovecot 尚未完全支援處理以這種方式接收的郵件,而且它既不需要也不一定有助於解決 amavis 中的問題。

  • amavis 有一個$log_level設定(在 Debian 中,大概在/etc/amavis/conf.d/可能會被歸零作為您的一部分紅郵分配

  • 如果您可以選擇切換它,則將 amavis 作為前置隊列運行過濾(而不是作為佇列後 smtpFilter)可能會也可能不會揭示更有用的錯誤或行為。

  • amavis 修復了一些特定於 mariadb 的 SQL+Unicode 問題在您使用的版本 2.11 之後,資料庫日誌中可能會出現一個有用的錯誤 - 或者可以透過比較配置有功能相同的 postgres 後端的相同堆疊來排除(postgres 不共用 MySQL 和 MariaDB 的 Unicode 功能/錯誤)

相關內容