https://bugs.koozali.org/show_bug.cgi?id=12265

            Bug ID: 12265
           Summary: update sieve /spam script
    Classification: Contribs
           Product: SME Contribs
           Version: 10.0
          Hardware: ---
                OS: ---
            Status: CONFIRMED
          Severity: normal
          Priority: P3
         Component: smeserver-dovecot-extras
          Assignee: [email protected]
          Reporter: [email protected]
        QA Contact: [email protected]
  Target Milestone: ---

Dec 13 18:53:50 mailserver dovecot: imap-login: Login: user=<user>,
method=PLAIN, rip=192.168.100.196, lip=192.168.100.4, mpid=18288, TLS,
session=<x>
Dec 13 18:53:50 mailserver dovecot: imap-login: Login: user=<smeserver>,
method=PLAIN, rip=192.168.100.196, lip=192.168.100.4, mpid=18294, TLS,
session=<z>
Dec 13 18:53:50 mailserver dovecot: imap-login: Login: user=<user>,
method=PLAIN, rip=192.168.100.196, lip=192.168.100.4, mpid=18295, TLS,
session=<w>
Dec 13 18:53:51 mailserver dovecot: imap(brianr): Error: write(program stdin)
failed: Broken pipe
Dec 13 18:53:51 mailserver dovecot: imap(brianr): program
`/usr/libexec/dovecot/learn-spam.sh' terminated with non-zero exit code 98
Dec 13 18:53:51 mailserver dovecot: imap(brianr): Error: sieve: pipe action:
failed to pipe message to program `learn-spam.sh': refer to server log for more
information. [2022-12-13 18:53:50]
Dec 13 18:53:51 mailserver dovecot: imap(brianr): sieve: left message in
mailbox 'junkmail'
Dec 13 18:53:51 mailserver dovecot: imap(brianr): Error: sieve: Execution of
script /usr/libexec/dovecot/sieve/report-spam.sieve failed
Dec 13 18:54:38 mailserver dovecot: lda(admin):
msgid=<[email protected]>: saved mail to INBOX
Dec 13 18:55:35 mailserver dovecot: imap-login: Disconnected (no auth attempts
in 0 secs): user=<>, rip=192.168.100.4, lip=192.168.100.4, TLS,
session=<ezNHKrrvJoPAqGQE>

we can see the current script date from 2017 see
https://git.fws.fr/fws/smeserver-dovecot-extras/commit/fca6acab5c01ce5e507603c8b639bf21089154a9.patch

>From fca6acab5c01ce5e507603c8b639bf21089154a9 Mon Sep 17 00:00:00 2001
From: Daniel Berteaud <[email protected]>
Date: Mon, 6 Mar 2017 17:53:33 +0100
Subject: [PATCH] Spam learning by moving to/from junkmail

dovecot suggest newer scripts
https://doc.dovecot.org/configuration_manual/howto/antispam_with_sieve/?highlight=imap%20filter%20sieve%20plugin

protocol imap {
  mail_plugins = $mail_plugins imap_sieve
}

plugin {
  sieve_plugins = sieve_imapsieve sieve_extprograms

  # From elsewhere to Spam folder
  imapsieve_mailbox1_name = Spam
  imapsieve_mailbox1_causes = COPY
  imapsieve_mailbox1_before = file:/usr/lib/dovecot/sieve/report-spam.sieve

  # From Spam folder to elsewhere
  imapsieve_mailbox2_name = *
  imapsieve_mailbox2_from = Spam
  imapsieve_mailbox2_causes = COPY
  imapsieve_mailbox2_before = file:/usr/lib/dovecot/sieve/report-ham.sieve

  sieve_pipe_bin_dir = /usr/lib/dovecot/sieve

  sieve_global_extensions = +vnd.dovecot.pipe +vnd.dovecot.environment
}


report-spam.sieve

require ["vnd.dovecot.pipe", "copy", "imapsieve", "environment", "variables"];

if environment :matches "imap.user" "*" {
  set "username" "${1}";
}

pipe :copy "sa-learn-spam.sh" [ "${username}" ];




report-ham.sieve

require ["vnd.dovecot.pipe", "copy", "imapsieve", "environment", "variables"];

if environment :matches "imap.mailbox" "*" {
  set "mailbox" "${1}";
}

if string "${mailbox}" "Trash" {
  stop;
}

if environment :matches "imap.user" "*" {
  set "username" "${1}";
}

pipe :copy "sa-learn-ham.sh" [ "${username}" ];



Shell scripts (untested)
sa-learn-spam.sh

#!/bin/sh
# you can also use tcp/ip here, consult spamc(1)
exec /usr/bin/spamc -u ${1} -L spam

sa-learn-ham.sh

#!/bin/sh
# you can also use tcp/ip here, consult spamc(1)
exec /usr/bin/spamc -u ${1} -L ham


sa-learn can cause lockout of the user for few minutes on initial run

sa-learn-spam.sh

#!/bin/sh
exec /usr/bin/sa-learn -u ${1} --spam

sa-learn-ham.sh

#!/bin/sh
exec /usr/bin/sa-learn -u ${1} --ham


If spamd is being used and the administrator is willing to accept the potential
security issues of allowing unauthenticated learning of spam/ham, spamd can be
invoked with the –allow-tell option and spamc with the –learntype= option.
Please consult the man pages of spamd and spamc for further details.

we might have done some changes to spamd config thate conflict with dovecot
sieve...

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.
_______________________________________________
Mail for each SME Contribs bug report
To unsubscribe, e-mail [email protected]
Searchable archive at https://lists.contribs.org/mailman/public/contribteam/

Reply via email to