Add global email delivery spam processing.

This commit is contained in:
Jim Hague 2024-04-04 11:24:04 +01:00
parent be351a6538
commit 188d410ea3
3 changed files with 32 additions and 1 deletions

View File

@ -18,7 +18,20 @@ dovecot_conf:
- mode: 0644
- names:
- /etc/dovecot/local.conf:
- source: salt://email/dovecot_local.conf
- source: salt://email/dovecot/dovecot_local.conf
sieve_conf:
file.recurse:
- name: /var/lib/dovecot/sieve-before.d
- dir_mode: '0755'
- file_mode: '0644'
- source: salt://email/dovecot/sieve-before.d
sieve_conf_compile:
cmd.run:
- name: for i in /var/lib/dovecot/sieve-before.d/*.sieve; do sievec $i; done
- onchanges:
- file: sieve_conf
dovecot_service:
service.running:

View File

@ -25,3 +25,8 @@ service auth {
group = Debian-exim
}
}
# Sieve. Enable global spam handling.
plugin {
sieve_before = /var/lib/dovecot/sieve-before.d/
}

View File

@ -0,0 +1,13 @@
require ["fileinfo"]
# Handle rspamd output
if header :contains "X-Spam-Status" "Yes"
{
fileinto :create "Spam";
stop;
}
if exists ["X-Spam-Bar"]
{
fileinto :create "Spam.ToClassify";
stop;
}