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

Rspamd : Blacklists not working consistently

· 52CE 我爱测

RSPAMD 3.5.2 Using the multimap module I am rejecting certain email addresses via a blacklist: multimap.conf blacklisted_addresses { description = "Blacklisted addresses"; type = "from"; prefilter = true; filter = "email"; map = …

问题原文

原帖链接 · Aditya K · CC BY-SA 4.0

RSPAMD 3.5.2

Using the multimap module I am rejecting certain email addresses via a blacklist:

multimap.conf

blacklisted_addresses {
    description = "Blacklisted addresses";
    type = "from";
    prefilter = true;
    filter = "email";
    map = "/${LOCAL_CONFDIR}/local.d/blocked_addresses.map";
    action = "reject";
    symbol = "BLACKLISTED_ADDRESS";
    regexp = "false";
}

In blocked_addresses.map I have a list of email addresses, one per line.

I put my own email address in there to test and this worked without any issue. I can see the blacklist working and I got a rejected email back from the mail server:

Error:

554 5.7.1 Matched map: BLACKLISTED_ADDRESS

However, other email addresses are able to get through. Here is one example where I'm trying to reject marketing emails from Amazon.

[email omitted]

Can someone please explain this behaviour? How can I debug this further?

已采纳解答

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

The from map type matches the envelope from and not the From: message Header (when both are present).

Fairly typical is that mailing list messages use uniquely generated SMTP envelope addresses to effectively handle bounces and delivery errors.

Then the "envelope from" probably looks something like from=<[email omitted]> rather than the [email omitted] address found in the message header.


Just like snail mail letters, SMTP email has two different sets of address information:

  • the envelope headers (like the addresses printed on the outside of an envelope, which is read and used by the Post Office to deliver the message to your mailbox) which are used by the SMTP servers to route and deliver the email. These correspond to the RCPT TO: and MAIL FROM: command words used in the SMTP transaction.

  • the "normal" headers, which are part of the mail message and which are only read and interpreted by the user in his mail client/webmail. These resemble the address attached to a salutation at the start of the physical letter found inside the envelope and similarly have no function in getting the message delivered correctly.
    These come as part of the DATA in the SMTP transaction.

  • the addresses in these two different headers can differ.

Historically there is no one standard on how MTA's store envelope data in messages, if at all. Therefor mail clients only display the normal headers.

Usually you need to take a look at "all headers", the "raw message" , "message source/properties" or similar to see if the MTA records the MAIL FROM: and RCPT TO: in some way.

You may see a Return-Path: <sender-address> Received: ... for <rcpt-address> or X-Original-To: <rcpt-address> or something else entirely. Alternatively the MTA will often store envelope headers used in the delivery log files.


You probably need to test but the "header" map and filtering on the From: header might work better for you:

blacklisted_addresses {
    description = "Blacklisted addresses";
    type = "header";
    header = "From"; 
    filter = "email";
...

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

资料来源与适用范围

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

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

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