DevHeads.net

Rspamd as milter and 'discard' action

I'm having trouble with Rspamd as a milter for Postfix, specifically
with Rspamd's discard action:

# /etc/rspamd/local.d/force_actions.conf
rules {
FOO_RULE {
expression = 'FOO_EXPR',
action = 'discard'
}
}

If I use the 'reject' action in Rspamd rules like the one shown above,
Postfix rejects matching messages on arrival, as is expected. However,
the actions 'discard' and 'quarantine' have no visible effect.

Since Rspamd merely offers a suggestion on how the MTA is supposed to
treat messages, I probably need to configure Postfix to honor 'discard'
suggestions? I have searched for quite a while but could not find a
solution, so I am asking for advice here. Thanks.

-Ralph

Comments

Re: Rspamd as milter and 'discard' action

By Viktor Dukhovni at 03/11/2019 - 17:12

When do you trigger than rule? Postfix supports 'discard', but only
after "MAIL FROM", not after CONNECT or EHLO.

/*
* Decision: accept and silently discard this message. According
* to the milter API documentation there will be no action when
* this is requested by a connection-level function. This
* decision is final (i.e. Sendmail 8 changes receiver state).
*/
case SMFIR_DISCARD:
if (data_size != 0)
break;
if (IN_CONNECT_EVENT(event)) {
msg_warn("milter %s: DISCARD action is not allowed "
"for connect or helo", milter->m.name);
MILTER8_EVENT_BREAK(milter->def_reply);
} else {
/* No more events for this message. */
milter->state = MILTER8_STAT_ACCEPT_MSG;
MILTER8_EVENT_BREAK("D");
}