Exim

Exim:接受後綴別名作為 ACL 中的 FROM 地址

  • April 16, 2021

我正在使用 exim 發送郵件。對於經過 SMTP 身份驗證的使用者,我已經添加了幾個 ACL,並希望添加另一個允許後綴別名的 ACL。後綴別名是電子郵件地址,例如“user+alias@example.com”。

環境如下所示:

  • 使用者名(完整的電子郵件地址)儲存在$authenticated_id
  • 設置的 FROM 地址儲存在$sender_address
  • “user@example.com”中的“使用者”可以在${local_part:$authenticated_id}
  • 認證使用者的域名在${domain:$authenticated_id}

現在我想實現如下所示的 ACL 規則:

# accept if FROM address is a suffix alias of authenticated address
accept
 condition = ${if match {$sender_address} {${local_part:$authenticated_id}+{*}@${domain:$authenticated_id}} }
 logwrite = AUTH OK - FROM address $sender_address is a suffix alias of authenticated user

不幸的是,ACL 規則似乎不正確。我收到以下錯誤消息:

failed to expand ACL string "${if match {$sender_address} {${local_part:$authenticated_id}+{*}@${domain:$authenticated_id}} }": curly-bracket problem in conditional yes/no parsing: 'yes' part did not start with '{'

問:上述條件有什麼問題,實現這一點的正確條件應該是什麼樣的?

在嘗試了幾次之後,我才開始工作。這就是規則應該是這樣的:

# accept if FROM address is a suffix alias of authenticated address
accept
 condition = ${if match {$sender_address} {(${local_part:$authenticated_id}\+.*@${domain:$authenticated_id})}}
 logwrite = AUTH OK - FROM address $sender_address is a suffix alias of authenticated user

引用自:https://serverfault.com/questions/1060480