Skip to content

email: Make rspamd learn spam/ham when the user marks mails as junk or not junk.

Benedek Nagy requested to merge nbenedek/freedombox:rspamd-learning into main

Add two sieve scripts for spam/ham learning. When the user moves a mail from anywhere to junk, or from junk to anywhere (except for trash) the mail is piped into the respective rspamc learn_spam/learn_ham command. The rspamc command is run as the mail user and the command requires that the user can connect to localhost:11334. Because of that, add the mail user to the allowed users that can access protected services.

The sievec compilation of the new scripts requre the dovecot-antispam package, so install it and increment the email version number.

Closes: #2487 (closed) Imroves: #56

Tests done:

  1. Apply the patches on an existing install
  2. Confirm the firewall and the email app get updated
  3. Move a mail from inbox to junk and confirm that rspamd statistics for "Learned" mails increment by one.
  4. Move back the mail from junk to inbox and confirm the number increments again.
  5. Move the mail to trash and confirm the script doesn't execute.
  6. Repeat steps 3-5 with mail_debug = yes in /etc/dovecot/dovecot.conf and confirm the script esxecution further by reading the debug logs.

Signed-off-by: Benedek Nagy contact@nbenedek.me

Merge request reports

Loading