Browse Source

Better sieve filters and lmtp support, auto nuke trash

master
Alex 1 year ago
parent
commit
44601962ca
Signed by: caskd GPG Key ID: F92BA85F61F4C173
  1. 11
      templates/default.sieve.j2
  2. 77
      templates/dovecot.conf.j2

11
templates/default.sieve.j2

@ -1,5 +1,10 @@
require ["fileinto", "mailbox"];
if header :contains "X-Spam-Flag" "YES"
require ["fileinto","mailbox"];
if anyof(
header :contains ["X-Spam-Flag"] "YES",
header :contains ["X-Spam-Status"] "spam",
header :contains ["X-Spam"] "Yes",
header :contains ["Subject"] "*** SPAM ***"
)
{
fileinto "Junk";
fileinto :create "Junk";
}

77
templates/dovecot.conf.j2

@ -101,6 +101,8 @@ dict {
# it's not found:
!include_try local.conf
protocols = imap lmtp
ssl = required
ssl_cert = </etc/ssl/private/mail/fullchain.pem
ssl_key = </etc/ssl/private/mail/privkey.pem
@ -118,7 +120,6 @@ passdb {
driver = pam
}
service imap-login {
inet_listener imap {
#address = none
@ -131,6 +132,22 @@ service imap-login {
}
}
service auth {
unix_listener /var/spool/postfix/private/auth {
mode = 0660
user = postfix
group = postfix
}
user = root
}
service lmtp {
unix_listener /var/spool/postfix/private/dovecot-lmtp {
mode = 0600
group = postfix
user = postfix
}
}
mail_location = maildir:~/Mail:INBOX=~/Mail/Inbox:LAYOUT=fs
namespace inbox {
inbox = yes
@ -149,30 +166,56 @@ namespace inbox {
}
mailbox Trash {
special_use = \Trash
autoexpunge = 7d
}
mailbox Archive {
special_use = \Archive
auto = subscribe
}
}
service auth {
unix_listener /var/spool/postfix/private/auth {
mode = 0660
user = postfix
group = postfix
}
user = root
}
protocol lda {
mail_plugins = $mail_plugins sieve
}
protocol lmtp {
mail_plugins = $mail_plugins sieve
}
plugin {
sieve = ~/.dovecot.sieve
sieve_default = /var/lib/dovecot/sieve/default.sieve
sieve_dir = ~/.sieve
sieve_global_dir = /var/lib/dovecot/sieve/
sieve_plugins = sieve_extprograms
sieve_extensions = +editheader +mboxmetadata +servermetadata +imapflags +notify +spamtest +spamtestplus +virustest
##
# rspamd:
#
# X-Spamd-Result: default: False [0.00 / 150.00]; ...
# X-Spam: Yes
##
# rspamd score based
#
# WARNING: the max score provided by rspamd is the maximum score
# rspamd cares about, e.g. the score required for reject, not
# necessarily the one for add_header, and therefore not a good
# baseline for what should be considered "100%" spam.
#
##
sieve_spamtest_status_type = score
sieve_spamtest_status_header = X-Spamd-Result: .*? \[([[:digit:]]+\.[[:digit:]]+) / [[:digit:]]+\.[[:digit:]]+\];
### best to use the same value as for `add_header` in rspamd
sieve_spamtest_max_value = 6
### can read the "max score" from rspamd, but see warning above
## sieve_spamtest_max_header = X-Spamd-Result: .*? \[[[:digit:]]+\.[[:digit:]]+ / ([[:digit:]]+\.[[:digit:]]+)\];
##
# Yes/No based
#
##
# sieve_spamtest_status_type = text
# sieve_spamtest_status_header = X-Spam
# sieve_spamtest_text_value1 = No
# sieve_spamtest_text_value10 = Yes
#
# Automatically filter spam into the spam folder
#
sieve_before = /usr/lib/dovecot/sieve/default.sieve
}