aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Joe Banks <[email protected]>2024-08-23 22:08:17 +0100
committerGravatar Joe Banks <[email protected]>2024-08-24 19:07:07 +0100
commitca21c7b418eea2061b501750778ca9c952583e74 (patch)
tree6aac3ee78308b2e4bbf65d5eb8e72be4f5d9712e
parentEnable spamc ham and spam learning (diff)
More progress on Dovecot ham/spam marking
-rw-r--r--ansible/roles/dovecot/tasks/main.yml2
-rw-r--r--ansible/roles/dovecot/templates/configs/10-mail.conf.j22
-rw-r--r--ansible/roles/dovecot/templates/configs/20-imap.conf.j2105
-rw-r--r--ansible/roles/dovecot/templates/configs/auth-ldap.conf.ext.j22
4 files changed, 109 insertions, 2 deletions
diff --git a/ansible/roles/dovecot/tasks/main.yml b/ansible/roles/dovecot/tasks/main.yml
index 6dc5c77..556cfcf 100644
--- a/ansible/roles/dovecot/tasks/main.yml
+++ b/ansible/roles/dovecot/tasks/main.yml
@@ -146,6 +146,7 @@
sieve_pipe_bin_dir = {{ dovecot_sieve_pipe_bin_dir }}
sieve_global_extensions = +vnd.dovecot.pipe
sieve_plugins = sieve_imapsieve sieve_extprograms
+ imapsieve_url = sieve://127.0.0.1:4190
marker: " # {mark} spam & ham autolearning (ansible managed)"
state: present
notify:
@@ -179,6 +180,7 @@
- 10-ssl.conf
- 15-mailboxes.conf
- 20-lmtp.conf
+ - 20-imap.conf
- auth-ldap.conf.ext
tags:
- role::dovecot
diff --git a/ansible/roles/dovecot/templates/configs/10-mail.conf.j2 b/ansible/roles/dovecot/templates/configs/10-mail.conf.j2
index 891e044..db165df 100644
--- a/ansible/roles/dovecot/templates/configs/10-mail.conf.j2
+++ b/ansible/roles/dovecot/templates/configs/10-mail.conf.j2
@@ -219,7 +219,7 @@ mail_privileged_group = mail
# Space separated list of plugins to load for all services. Plugins specific to
# IMAP, LDA, etc. are added to this list in their own .conf files.
-mail_plugins = welcome
+mail_plugins = welcome notify
##
## Mailbox handling optimizations
diff --git a/ansible/roles/dovecot/templates/configs/20-imap.conf.j2 b/ansible/roles/dovecot/templates/configs/20-imap.conf.j2
new file mode 100644
index 0000000..615cb86
--- /dev/null
+++ b/ansible/roles/dovecot/templates/configs/20-imap.conf.j2
@@ -0,0 +1,105 @@
+# Ansible Managed
+
+##
+## IMAP specific settings
+##
+
+# If nothing happens for this long while client is IDLEing, move the connection
+# to imap-hibernate process and close the old imap process. This saves memory,
+# because connections use very little memory in imap-hibernate process. The
+# downside is that recreating the imap process back uses some resources.
+#imap_hibernate_timeout = 0
+
+# Maximum IMAP command line length. Some clients generate very long command
+# lines with huge mailboxes, so you may need to raise this if you get
+# "Too long argument" or "IMAP command line too large" errors often.
+#imap_max_line_length = 64k
+
+# IMAP logout format string:
+# %i - total number of bytes read from client
+# %o - total number of bytes sent to client
+# %{fetch_hdr_count} - Number of mails with mail header data sent to client
+# %{fetch_hdr_bytes} - Number of bytes with mail header data sent to client
+# %{fetch_body_count} - Number of mails with mail body data sent to client
+# %{fetch_body_bytes} - Number of bytes with mail body data sent to client
+# %{deleted} - Number of mails where client added \Deleted flag
+# %{expunged} - Number of mails that client expunged, which does not
+# include automatically expunged mails
+# %{autoexpunged} - Number of mails that were automatically expunged after
+# client disconnected
+# %{trashed} - Number of mails that client copied/moved to the
+# special_use=\Trash mailbox.
+# %{appended} - Number of mails saved during the session
+#imap_logout_format = in=%i out=%o deleted=%{deleted} expunged=%{expunged} \
+# trashed=%{trashed} hdr_count=%{fetch_hdr_count} \
+# hdr_bytes=%{fetch_hdr_bytes} body_count=%{fetch_body_count} \
+# body_bytes=%{fetch_body_bytes}
+
+# Override the IMAP CAPABILITY response. If the value begins with '+',
+# add the given capabilities on top of the defaults (e.g. +XFOO XBAR).
+#imap_capability =
+
+# How long to wait between "OK Still here" notifications when client is
+# IDLEing.
+#imap_idle_notify_interval = 2 mins
+
+# ID field names and values to send to clients. Using * as the value makes
+# Dovecot use the default value. The following fields have default values
+# currently: name, version, os, os-version, support-url, support-email,
+# revision.
+#imap_id_send =
+
+# ID fields sent by client to log. * means everything.
+#imap_id_log =
+
+# Workarounds for various client bugs:
+# delay-newmail:
+# Send EXISTS/RECENT new mail notifications only when replying to NOOP
+# and CHECK commands. Some clients ignore them otherwise, for example OSX
+# Mail (<v2.1). Outlook Express breaks more badly though, without this it
+# may show user "Message no longer in server" errors. Note that OE6 still
+# breaks even with this workaround if synchronization is set to
+# "Headers Only".
+# tb-extra-mailbox-sep:
+# Thunderbird gets somehow confused with LAYOUT=fs (mbox and dbox) and
+# adds extra '/' suffixes to mailbox names. This option causes Dovecot to
+# ignore the extra '/' instead of treating it as invalid mailbox name.
+# tb-lsub-flags:
+# Show \Noselect flags for LSUB replies with LAYOUT=fs (e.g. mbox).
+# This makes Thunderbird realize they aren't selectable and show them
+# greyed out, instead of only later giving "not selectable" popup error.
+#
+# The list is space-separated.
+#imap_client_workarounds =
+
+# Host allowed in URLAUTH URLs sent by client. "*" allows all.
+#imap_urlauth_host =
+
+# Enable IMAP LITERAL- extension (replaces LITERAL+)
+#imap_literal_minus = no
+
+# What happens when FETCH fails due to some internal error:
+# disconnect-immediately:
+# The FETCH is aborted immediately and the IMAP client is disconnected.
+# disconnect-after:
+# The FETCH runs for all the requested mails returning as much data as
+# possible. The client is finally disconnected without a tagged reply.
+# no-after:
+# Same as disconnect-after, but tagged NO reply is sent instead of
+# disconnecting the client. If the client attempts to FETCH the same failed
+# mail more than once, the client is disconnected. This is to avoid clients
+# from going into infinite loops trying to FETCH a broken mail.
+#imap_fetch_failure = disconnect-immediately
+
+mail_attribute_dict = file:~/mail/dovecot-attributes
+
+protocol imap {
+ # Space separated list of plugins to load (default is global mail_plugins).
+ mail_plugins = $mail_plugins imap_sieve
+
+ imap_metadata = yes
+
+ # Maximum number of IMAP connections allowed for a user from each IP address.
+ # NOTE: The username is compared case-sensitively.
+ #mail_max_userip_connections = 10
+}
diff --git a/ansible/roles/dovecot/templates/configs/auth-ldap.conf.ext.j2 b/ansible/roles/dovecot/templates/configs/auth-ldap.conf.ext.j2
index ef3dc9e..a3628a1 100644
--- a/ansible/roles/dovecot/templates/configs/auth-ldap.conf.ext.j2
+++ b/ansible/roles/dovecot/templates/configs/auth-ldap.conf.ext.j2
@@ -13,5 +13,5 @@ passdb {
userdb {
driver = static
- args = uid=vmail gid=vmail home=/var/vmail/%u mail=maildir:~/mail sieve=/home/%u/sieve
+ args = uid=vmail gid=vmail home=/var/vmail/%u mail=maildir:~/mail sieve=/home/%u/sieve sieve_user_log=/var/mail/%u/sieve.log
}