Replacement for antispam plugin

Håkon Alstadheim hakon at alstadheim.priv.no
Mon Feb 13 01:30:19 UTC 2017



Den 12. feb. 2017 23:56, skrev Marcus Rueckert:
> On 2017-02-12 23:00:49 +0100, Håkon Alstadheim wrote:
>> Just follow the wiki and replace sa-learn scripts with calling dspam.
>> Dspam direct pipe needs mail-line-endings (\r\n) translated into unix
>> line-endings (\r).
I had a typo here, (\r\n) gets replaced by just (\n).

> 
> tbh ... what do you do about mails which just use \r as separator?
> 

You are mistaken.

Firstly: s/\r$// will remove \r from the end of any line, do nothing if
there is no \r.
Secondly: All line-endings as seen by transfer-agents is transferred
with the same line endings (MTA-MTA: \r\n; locally: usually the same but
may be different). "Line ending" here pertains to after each header, and
between message-parts. If there are naked (\n) characters in the message
body, that is of no concern. Point of filter is to make Dspam-signature
parseable for dspam. If there is an (\r) at the end of the header, Dspam
will not find a match, and be unable to reclassify the mail.

> s|\r\n|\n| is safer.
> 
>     darix
> 
>> like so:
>>
>> ----- learn-spam.sh ---------
>> #!/bin/sh
>> sed -e 's/\r$//' | /usr/bin/dspam --source=error --class=spam
>>
>> ----- learn-ham.sh ----------
>> #!/bin/sh
>> sed -e 's/\r$//' | /usr/bin/dspam --source=error --class=innocent
>>
>> ------
>>
>> Theese will be invoked with the owner of the mailbox as current uid, so
>> that is all.
> 


More information about the dovecot mailing list