Rspamd: [BUG] MULTIMAP email:addr gets higher priority

Created on 26 Nov 2019  路  3Comments  路  Source: rspamd/rspamd

Describe the bug
on a centos7 with rspamd 2.2 the multimap gets a higer priority to email:addr and even with conditionnal MAP the map with IP is not accepted

Steps to Reproduce

  1. set a multimap configuration

  2. put a domain blacklisted and an IP whitelisted

/etc/rspamd/blacklist_from_domains.map:de-labrusse.fr
/etc/rspamd/whitelist_ip.map:192.168.56.15
/etc/rspamd/whitelist_to.map:[email protected]

the email is accepted with the good symbol

Nov 26 17:44:48 ns7loc14 rspamd[904]: <8bab0e>; proxy; rspamd_add_passthrough_result: <undef>: set pre-result to 'no action' (no score): 'Matched map: IP_WHITELIST' from multimap(1)
Nov 26 17:44:48 ns7loc14 rspamd[904]: <8bab0e>; proxy; rspamd_task_write_log: id: <undef>, qid: <89FC460CE706>, ip: 192.168.56.15, from: <[email protected]>, (default: F (no action): [0.00/20.00] [IP_WHITELIST(0.00){192.168.56.15;}]), len: 175, time: 36.642ms real, 14.404ms virtual, dns req: 1, digest: <477309d6ded6f6ec6291b7351021d5a6>, rcpts: <[email protected]>, mime_rcpts: <[email protected]>, forced: no action "Matched map: IP_WHITELIST"; score=nan (set by multimap)
  1. remove the domain blacklisted, set an email, keep the IP whitelist
/etc/rspamd/blacklist_from.map:[email protected]
/etc/rspamd/whitelist_ip.map:192.168.56.15
/etc/rspamd/whitelist_to.map:[email protected]

the email is rejected with the MAP symbol of the email FROM_BLACKLIST

Nov 26 17:46:22 ns7loc14 rspamd[1989]: <a8b108>; proxy; rspamd_add_passthrough_result: <undef>: set pre-result to 'reject' (no score): 'Sender address rejected' from multimap(1)
Nov 26 17:46:22 ns7loc14 rspamd[1989]: <a8b108>; proxy; rspamd_task_write_log: id: <undef>, qid: <157FC60CE706>, ip: 192.168.56.15, from: <[email protected]>, (default: T (reject): [0.00/20.00] [FROM_BLACKLIST(0.00){[email protected];}]), len: 175, time: 21.777ms real, 4.678ms virtual, dns req: 1, digest: <477309d6ded6f6ec6291b7351021d5a6>, rcpts: <[email protected]>, mime_rcpts: <[email protected]>, forced: reject "Sender address rejected"; score=nan (set by multimap)

Expected behavior

I expect that with the same configuration, even with a conditionnal map, the map BLACKLIST_FROM does not match if the IP_WHITELIST match the rule. Moreover I ask myself what is now the priority, I feel that something has changed, this is the list of map from configdump, I do not know if it is in relation

[root@ns7loc14 ~]# rspamadm configdump | grep -E '(WHITE|BLACK)LIST \{'
    TO_DOMAINS_WHITELIST {
    FROM_SUBDOMAINS_WHITELIST {
    TO_SUBDOMAINS_WHITELIST {
    FROM_BLACKLIST {
    FROM_WHITELIST {
    IP_WHITELIST {
    FROM_DOMAINS_BLACKLIST {
    FROM_SUBDOMAINS_BLACKLIST {
    FROM_DOMAINS_WHITELIST {
    TO_WHITELIST {

Versions

Rspamd daemon version 2.2

Additional Information

bug

Most helpful comment

All 3 comments

this could be achieved by this way in multimap

# whitelist the IP
IP_WHITELIST {
    type = "ip";
    prefilter = "true";
    map = "${CONFDIR}/whitelist_ip.map";
    action = "accept";
    symbol = "IP_WHITELIST";
    description = "Accept SMTP sender by exact IP address";
  }

#blacklist the senders
FROM_BLACKLIST {
  type = "combined";
  rules {
    ip = { 
      type = "radix";
      map = "${CONFDIR}/whitelist_ip.map";
      selector = "ip";
    }
    from {
      map = "${CONFDIR}/blacklist_from.map";
      selector = "from";
    }
  }
  expression = "!ip &&  from"
  action = "reject";
  message = "Sender address rejected";
}

First I would like to thank you to point me in the right direction, I solved this issue, the blacklist from takes the priority, I would like to know where I could find some clues to write a little documentation for example I needed some tests to understand how to write the selector from.
so we have from, from:domain do we have something like the email:domain and email:domain:tld

Now mostly I can do like above in my settings, but I figure if somewhere the statement of priority is not clear for me or broken, so if you can explain how the priority with multimap should work, I would be pleased

set closed as as workaround above

Was this page helpful?
0 / 5 - 0 ratings