rmilter rule to conditionally analyze emails

62 views
Skip to first unread message

marco....@gmail.com

unread,
Jan 3, 2017, 3:36:59 AM1/3/17
to rspamd
Hi all,
I am new to rmilter / rspamd.

I am looking for a way to have rmilter passing an email to analyze ONLY if the email contains a specific header "TEST: this is a test".

I think that the right way to achieve this would be to leverage the "rule" syntax. But I found it completely undocumented...(?).

Could you help me out?

How can I check *within rmilter* for the presence of a specific header and act upon?

Thank you in advance
Marco

Vsevolod Stakhov

unread,
Jan 3, 2017, 5:34:44 AM1/3/17
to marco....@gmail.com, rspamd
Don't use Rmilter for anything but just passing messages from MTA to
Rspamd. In turn, Rspamd can do what you'd like by writing a simple
prefilter rule like this one:

rspamd_config.TEST_CHECK = {
callback = function(task)
if not task:get_header(...) then
task:set_pre_result('no action')
end
end,
type = 'prefilter',
score = 0.0,
> --
> You received this message because you are subscribed to the Google
> Groups "rspamd" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to rspamd+un...@googlegroups.com
> <mailto:rspamd+un...@googlegroups.com>.
> Visit this group at https://groups.google.com/group/rspamd.


--
Vsevolod Stakhov

Marco Pizzoli

unread,
Jan 4, 2017, 1:50:58 PM1/4/17
to Vsevolod Stakhov, rspamd
Hi Vsevolod,
thank you very much for your answer.

I take your point about using rspamd (and lua) and I tried to go this way.
But I eventually failed to get the rule being executed.

Could you tell me exactly where that ruel is supposed to be written and eventually executed?

I wrote it directly in /etc/rspamd/rspamd.local.lua but that file appears to get ignored...
What am I doing wrong?

Any help is welcome
Thank you again

Marco


Andrew Lewis

unread,
Jan 4, 2017, 5:09:01 PM1/4/17
to rsp...@googlegroups.com

Hi Marco,

> I wrote it directly in /etc/rspamd/rspamd.local.lua but that file appears
> to get ignored...

That's the correct place for this stuff to be; have you restarted?-
maybe you have some error in runtime during scan (rspamd log will show
it) or your rule doesn't otherwise work as intended (how does it look?).

Best,
-AL.

marco....@gmail.com

unread,
Feb 9, 2017, 2:43:08 PM2/9/17
to rspamd
Hi Andrew,
Sorry for the late answer but I have been busy with other stuff.
It was indeed my stupid fault. I forgot to make the file readable by the rspamd user

Thank you very much for your help anyway
Marco
Reply all
Reply to author
Forward
0 new messages