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 {
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.



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).
if (data_size != 0)
if (IN_CONNECT_EVENT(event)) {
msg_warn("milter %s: DISCARD action is not allowed "
"for connect or helo", milter->;
} else {
/* No more events for this message. */
milter->state = MILTER8_STAT_ACCEPT_MSG;