From 7b3c1ece8dbbf8fac364668cc4f611398eaf5ae2 Mon Sep 17 00:00:00 2001 From: mwiegand Date: Mon, 18 Oct 2021 22:15:33 +0200 Subject: [PATCH] spam --- bundles/dovecot/files/dovecot.conf | 2 +- bundles/dovecot/files/learn-ham.sh | 2 + bundles/dovecot/files/learn-spam.sh | 2 + ...spam-global.sieve => spam-to-folder.sieve} | 0 bundles/dovecot/items.py | 39 ++++++++++++++----- 5 files changed, 34 insertions(+), 11 deletions(-) create mode 100644 bundles/dovecot/files/learn-ham.sh create mode 100644 bundles/dovecot/files/learn-spam.sh rename bundles/dovecot/files/{spam-global.sieve => spam-to-folder.sieve} (100%) diff --git a/bundles/dovecot/files/dovecot.conf b/bundles/dovecot/files/dovecot.conf index 57daf4e..86f6a12 100644 --- a/bundles/dovecot/files/dovecot.conf +++ b/bundles/dovecot/files/dovecot.conf @@ -119,7 +119,7 @@ plugin { sieve_pipe_bin_dir = /var/vmail/sieve/ sieve_extensions = +vnd.dovecot.pipe - sieve_before = /var/vmail/sieve/global/spam-global.sieve + sieve_after = /var/vmail/sieve/global/spam-to-folder.sieve # From elsewhere to Spam folder imapsieve_mailbox1_name = Junk diff --git a/bundles/dovecot/files/learn-ham.sh b/bundles/dovecot/files/learn-ham.sh new file mode 100644 index 0000000..c30528f --- /dev/null +++ b/bundles/dovecot/files/learn-ham.sh @@ -0,0 +1,2 @@ +#!/bin/sh +exec /usr/bin/rspamc learn_ham diff --git a/bundles/dovecot/files/learn-spam.sh b/bundles/dovecot/files/learn-spam.sh new file mode 100644 index 0000000..da8e276 --- /dev/null +++ b/bundles/dovecot/files/learn-spam.sh @@ -0,0 +1,2 @@ +#!/bin/sh +exec /usr/bin/rspamc learn_spam diff --git a/bundles/dovecot/files/spam-global.sieve b/bundles/dovecot/files/spam-to-folder.sieve similarity index 100% rename from bundles/dovecot/files/spam-global.sieve rename to bundles/dovecot/files/spam-to-folder.sieve diff --git a/bundles/dovecot/items.py b/bundles/dovecot/items.py index e976e87..16ead64 100644 --- a/bundles/dovecot/items.py +++ b/bundles/dovecot/items.py @@ -19,7 +19,16 @@ directories = { '/var/vmail': { 'owner': 'vmail', 'group': 'vmail', - } + }, + '/var/vmail/sieve': { + 'owner': 'vmail', + 'group': 'vmail', + }, + '/var/vmail/sieve/global': { + 'purge': True, + 'owner': 'vmail', + 'group': 'vmail', + }, } files = { @@ -59,17 +68,27 @@ files = { 'svc_systemd:dovecot:restart', }, }, - '/var/mail/vmail/sieve/global/learn-ham.sieve': { - 'owner': 'nobody', - 'group': 'nogroup', + '/var/vmail/sieve/global/spam-to-folder.sieve': { + 'owner': 'vmail', + 'group': 'vmail', }, - '/var/mail/vmail/sieve/global/learn-spam.sieve': { - 'owner': 'nobody', - 'group': 'nogroup', + '/var/vmail/sieve/global/learn-ham.sieve': { + 'owner': 'vmail', + 'group': 'vmail', }, - '/var/mail/vmail/sieve/global/spam-global.sieve': { - 'owner': 'nobody', - 'group': 'nogroup', + '/var/vmail/sieve/global/learn-ham.sh': { + 'owner': 'vmail', + 'group': 'vmail', + 'mode': '550', + }, + '/var/vmail/sieve/global/learn-spam.sieve': { + 'owner': 'vmail', + 'group': 'vmail', + }, + '/var/vmail/sieve/global/learn-spam.sh': { + 'owner': 'vmail', + 'group': 'vmail', + 'mode': '550', }, }