Skip to content

Commit d5f2f28

Browse files
committed
Update dovecot configuration comments to 2.3
This integrates the diff we had when deploying our changes on top of the distribution-supplied Dovecot 2.3 configuration file.
1 parent 202bab6 commit d5f2f28

11 files changed

Lines changed: 364 additions & 220 deletions

File tree

ansible/roles/dovecot/tasks/main.yml

Lines changed: 1 addition & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -98,17 +98,6 @@
9898
tags:
9999
- role::dovecot
100100

101-
- name: Set up sieve configuration for dovecot
102-
lineinfile:
103-
path: /etc/dovecot/conf.d/90-sieve.conf
104-
regexp: "sieve_after ="
105-
line: " sieve_after = /etc/dovecot/sieve-after # (ansible managed)"
106-
state: present
107-
notify:
108-
- Reload Dovecot
109-
tags:
110-
- role::dovecot
111-
112101
- name: Create dovecot spam & ham sieve scripts
113102
template:
114103
src: "{{ item }}.j2"
@@ -149,33 +138,6 @@
149138
tags:
150139
- role::dovecot
151140

152-
- name: Enable dovecot spamc learning integration
153-
blockinfile:
154-
path: /etc/dovecot/conf.d/90-sieve.conf
155-
insertbefore: "^}$"
156-
content: |2
157-
# From elsewhere to Junk folder
158-
imapsieve_mailbox1_name = Junk
159-
imapsieve_mailbox1_causes = COPY
160-
imapsieve_mailbox1_before = file:/etc/dovecot/sieve/learn-spam.sieve
161-
162-
# From Junk folder to elsewhere
163-
imapsieve_mailbox2_name = *
164-
imapsieve_mailbox2_from = Junk
165-
imapsieve_mailbox2_causes = COPY
166-
imapsieve_mailbox2_before = file:/etc/dovecot/sieve/learn-ham.sieve
167-
168-
sieve_pipe_bin_dir = {{ dovecot_sieve_pipe_bin_dir }}
169-
sieve_global_extensions = +vnd.dovecot.pipe
170-
sieve_plugins = sieve_imapsieve sieve_extprograms
171-
imapsieve_url = sieve://127.0.0.1:4190
172-
marker: " # {mark} spam & ham autolearning (ansible managed)"
173-
state: present
174-
notify:
175-
- Reload Dovecot
176-
tags:
177-
- role::dovecot
178-
179141
# BEGIN temporary cleanup task
180142
- name: Kill Dovecot LDAP config
181143
file:
@@ -204,6 +166,7 @@
204166
- 20-lmtp.conf
205167
- 20-imap.conf
206168
- 90-acl.conf
169+
- 90-sieve.conf
207170
- auth-ldap.conf.ext
208171
tags:
209172
- role::dovecot

ansible/roles/dovecot/templates/configs/10-auth.conf.j2

Lines changed: 21 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,18 @@
44
## Authentication processes
55
##
66

7-
# Disable LOGIN command and all other plaintext authentications unless
8-
# SSL/TLS is used (LOGINDISABLED capability). Note that if the remote IP
7+
#log_debug=category=auth
8+
#auth_debug_passwords = yes
9+
10+
# Enable LOGIN command and all other plaintext authentications even if
11+
# SSL/TLS is not used (LOGINDISABLED capability). Note that if the remote IP
912
# matches the local IP (ie. you're connecting from the same computer), the
10-
# connection is considered secure and plaintext authentication is allowed.
11-
# See also ssl=required setting.
13+
# connection is considered secure and plaintext authentication is allowed,
14+
# unless ssl = required.
1215
auth_allow_cleartext = no
1316

1417
# Authentication cache size (e.g. 10M). 0 means it's disabled. Note that
15-
# bsdauth and PAM require cache_key to be set for caching to be used.
18+
# bsdauth, PAM and vpopmail require cache_key to be set for caching to be used.
1619
#auth_cache_size = 0
1720
# Time to live for cached data. After TTL expires the cached record is no
1821
# longer used, *except* if the main database lookup returns internal failure.
@@ -32,7 +35,7 @@ auth_allow_cleartext = no
3235

3336
# Default realm/domain to use if none was specified. This is used for both
3437
# SASL realms and appending @domain to username in plaintext logins.
35-
#auth_default_realm =
38+
#auth_default_domain =
3639

3740
# List of allowed characters in username. If the user-given username contains
3841
# a character not listed in here, the login automatically fails. This is just
@@ -46,11 +49,10 @@ auth_allow_cleartext = no
4649
# that '#' and '/' characters are translated to '@'.
4750
#auth_username_translation =
4851

49-
# Username formatting before it's looked up from databases. You can use
50-
# the standard variables here, eg. %Lu would lowercase the username, %n would
51-
# drop away the domain if it was given, or "%n-AT-%d" would change the '@' into
52-
# "-AT-". This translation is done after auth_username_translation changes.
53-
auth_username_format = %Ln
52+
# Username formatting before it's looked up from databases.
53+
auth_username_format = %{user|lower}
54+
#auth_username_format = %{user|username|lower}
55+
5456

5557
# If you want to allow master users to log in by specifying the master
5658
# username within the normal username string (ie. not using SASL mechanism's
@@ -62,11 +64,6 @@ auth_username_format = %Ln
6264
# Username to use for users logging in with ANONYMOUS SASL mechanism
6365
#auth_anonymous_username = anonymous
6466

65-
# Maximum number of dovecot-auth worker processes. They're used to execute
66-
# blocking passdb and userdb queries (eg. MySQL and PAM). They're
67-
# automatically created and destroyed as needed.
68-
#auth_worker_max_count = 30
69-
7067
# Host name to use in GSSAPI principal names. The default is to use the
7168
# name returned by gethostname(). Use "$ALL" (with quotes) to allow all keytab
7269
# entries.
@@ -78,7 +75,7 @@ auth_username_format = %Ln
7875
#auth_krb5_keytab =
7976

8077
# Do NTLM and GSS-SPNEGO authentication using Samba's winbind daemon and
81-
# ntlm_auth helper. <doc/wiki/Authentication/Mechanisms/Winbind.txt>
78+
# ntlm_auth helper. <https://doc.dovecot.org/latest/core/config/auth/mechanisms/winbind.html>
8279
#auth_use_winbind = no
8380

8481
# Path for Samba's ntlm_auth helper binary.
@@ -96,10 +93,10 @@ auth_username_format = %Ln
9693
#auth_ssl_username_from_cert = no
9794

9895
# Space separated list of wanted authentication mechanisms:
99-
# plain login digest-md5 cram-md5 ntlm rpa apop anonymous gssapi otp
100-
# gss-spnego
101-
# NOTE: See also disable_plaintext_auth setting.
102-
auth_mechanisms = plain login
96+
# plain login digest-md5 cram-md5 ntlm anonymous gssapi
97+
# gss-spnego xoauth2 oauthbearer
98+
# NOTE: See also auth_allow_cleartext setting.
99+
#auth_mechanisms = plain login
103100

104101
##
105102
## Password and user databases
@@ -111,15 +108,16 @@ auth_mechanisms = plain login
111108
# allow both system users (/etc/passwd) and virtual users to login without
112109
# duplicating the system users into virtual database.
113110
#
114-
# <doc/wiki/PasswordDatabase.txt>
111+
# <https://doc.dovecot.org/latest/core/config/auth/passdb.html>
115112
#
116113
# User database specifies where mails are located and what user/group IDs
117114
# own them. For single-UID configuration use "static" userdb.
118115
#
119-
# <doc/wiki/UserDatabase.txt>
116+
# <https://doc.dovecot.org/latest/core/config/auth/userdb.html>
120117

121118
#!include auth-deny.conf.ext
122119
#!include auth-master.conf.ext
120+
#!include auth-oauth2.conf.ext
123121

124122
#!include auth-system.conf.ext
125123
#!include auth-sql.conf.ext

ansible/roles/dovecot/templates/configs/10-mail.conf.j2

Lines changed: 44 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
## Mailbox locations and namespaces
55
##
66

7-
# Location for users' mailboxes. The
7+
# Location for users' mailboxes. The default is empty, which means that Dovecot
88
# tries to find the mailboxes automatically. This won't work if the user
99
# doesn't yet have any mail, so you should explicitly tell Dovecot the full
1010
# location.
@@ -14,22 +14,26 @@
1414
# kept. This is called the "root mail directory", and it must be the first
1515
# path given in the mail_location setting.
1616
#
17-
# There are a few special variables you can use, eg.:
17+
# %{user} - username
18+
# %{user|username} - user part in user@domain, same as %u if there's no domain
19+
# %{user|domain} - domain part in user@domain, empty if there's no domain
20+
# %{home} - home directory
1821
#
19-
# %u - username
20-
# %n - user part in user@domain, same as %u if there's no domain
21-
# %d - domain part in user@domain, empty if there's no domain
22-
# %h - home directory
22+
# See https://doc.dovecot.org/latest/core/settings/variables.html for full list
23+
# of variables.
2324
#
24-
# See doc/wiki/Variables.txt for full list. Some examples:
25+
# Example:
26+
# mail_driver = maildir
27+
# mail_path = ~/Maildir
28+
# mail_inbox_path = ~/Maildir/.INBOX
2529
#
26-
# mail_location = maildir:~/Maildir
27-
# mail_location = mbox:~/mail:INBOX=/var/mail/%u
28-
# mail_location = mbox:/var/mail/%d/%1n/%n:INDEX=/var/indexes/%d/%1n/%n
29-
#
30-
# <doc/wiki/MailLocation.txt>
31-
#
32-
mail_home = /var/vmail/%{user}
30+
31+
# Debian defaults
32+
# Note that upstream considers mbox deprecated and strongly recommends
33+
# against its use in production environments. See further information
34+
# at
35+
# https://doc.dovecot.org/2.4.0/core/config/mailbox/formats/mbox.html
36+
mail_home = /var/vmail/%{user | username}
3337
mail_driver = Maildir
3438
mail_path = %{home}/mail
3539

@@ -59,7 +63,8 @@ namespace inbox {
5963

6064
# Physical location of the mailbox. This is in same format as
6165
# mail_location, which is also the default for it.
62-
#location =
66+
# mail_driver =
67+
# mail_path =
6368

6469
# There can be only one INBOX, and this setting defines which namespace
6570
# has it.
@@ -85,18 +90,20 @@ namespace inbox {
8590
}
8691

8792
# Example shared namespace configuration
88-
#namespace {
93+
#namespace shared {
8994
#type = shared
9095
#separator = /
9196

9297
# Mailboxes are visible under "shared/user@domain/"
93-
# %%n, %%d and %%u are expanded to the destination user.
94-
#prefix = shared/%%u/
98+
# $user, $domain and $username are expanded to the destination user.
99+
#prefix = shared/$user/
95100

96-
# Mail location for other users' mailboxes. Note that %variables and ~/
97-
# expands to the logged in user's data. %%n, %%d, %%u and %%h expand to the
101+
# Mail location for other users' mailboxes. Note that %{variables} and ~/
102+
# expands to the logged in user's data. %{owner_user} and %{owner_home}
98103
# destination user's data.
99-
#location = maildir:%%h/Maildir:INDEX=~/Maildir/shared/%%u
104+
#mail_driver = maildir
105+
#mail_path = %{owner_home}/Maildir
106+
#mail_index_path = ~/Maildir/shared/%{owner_user}
100107

101108
# Use the default namespace for saving subscriptions.
102109
#subscriptions = no
@@ -109,11 +116,11 @@ namespace inbox {
109116

110117
# System user and group used to access mails. If you use multiple, userdb
111118
# can override these by returning uid or gid fields. You can use either numbers
112-
# or names. <doc/wiki/UserIds.txt>
119+
# or names. <https://doc.dovecot.org/latest/core/config/system_users.html#uids>
113120
mail_uid = {{ dovecot_vmail_uid }}
114121
mail_gid = {{ dovecot_vmail_uid }}
115122

116-
# Group to enable temporarily for privileged operations. Currently this is
123+
# Group to enable temporarily for privileged operations. Currently this is
117124
# used only with INBOX when either its initial creation or dotlocking fails.
118125
# Typically this is set to "mail" to give access to /var/mail.
119126
mail_privileged_group = mail
@@ -133,7 +140,11 @@ mail_privileged_group = mail
133140

134141
# Dictionary for key=value mailbox attributes. This is used for example by
135142
# URLAUTH and METADATA extensions.
136-
#mail_attribute_dict =
143+
#mail_attribute {
144+
# dict file {
145+
# path = %{home}/Maildir/dovecot-attributes
146+
# }
147+
#}
137148

138149
# A comment or note that is associated with the server. This value is
139150
# accessible for authenticated users through the IMAP METADATA server
@@ -216,10 +227,16 @@ mail_privileged_group = mail
216227
#auth_socket_path = /var/run/dovecot/auth-userdb
217228

218229
# Directory where to look up mail plugins.
219-
#mail_plugin_dir = /usr/lib/dovecot/modules
230+
#mail_plugin_dir = /usr/lib/dovecot
220231

221232
# Space separated list of plugins to load for all services. Plugins specific to
222233
# IMAP, LDA, etc. are added to this list in their own .conf files.
234+
#mail_plugins =
235+
#
236+
# To add plugins, use
237+
#mail_plugins {
238+
# plugin = yes
239+
#}
223240
mail_plugins {
224241
welcome = yes
225242
notify = yes
@@ -249,7 +266,7 @@ mail_plugins {
249266

250267
# When IDLE command is running, mailbox is checked once in a while to see if
251268
# there are any new mails or other changes. This setting defines the minimum
252-
# time to wait between those checks.
269+
# time to wait between those checks. Dovecot can also use inotify and
253270
# kqueue to find out immediately when changes occur.
254271
#mailbox_idle_check_interval = 30 secs
255272

@@ -328,14 +345,8 @@ protocol !indexer-worker {
328345
# in is important to avoid deadlocks if other MTAs/MUAs are using multiple
329346
# locking methods as well. Some operating systems don't allow using some of
330347
# them simultaneously.
331-
#
332-
# The Debian value for mbox_write_locks differs from upstream Dovecot. It is
333-
# changed to be compliant with Debian Policy (section 11.6) for NFS safety.
334-
# Dovecot: mbox_write_locks = dotlock fcntl
335-
# Debian: mbox_write_locks = fcntl dotlock
336-
#
337348
#mbox_read_locks = fcntl
338-
#mbox_write_locks = fcntl dotlock
349+
#mbox_write_locks = dotlock fcntl
339350

340351
# Maximum time to wait for lock (all of them) before aborting.
341352
#mbox_lock_timeout = 5 mins
@@ -391,32 +402,6 @@ protocol !indexer-worker {
391402
# filesystems (ext4, xfs).
392403
#mdbox_preallocate_space = no
393404

394-
##
395-
## Mail attachments
396-
##
397-
398-
# sdbox and mdbox support saving mail attachments to external files, which
399-
# also allows single instance storage for them. Other backends don't support
400-
# this for now.
401-
402-
# Directory root where to store mail attachments. Disabled, if empty.
403-
#mail_attachment_dir =
404-
405-
# Attachments smaller than this aren't saved externally. It's also possible to
406-
# write a plugin to disable saving specific attachments externally.
407-
#mail_attachment_min_size = 128k
408-
409-
# Filesystem backend to use for saving attachments:
410-
# posix : No SiS done by Dovecot (but this might help FS's own deduplication)
411-
# sis posix : SiS with immediate byte-by-byte comparison during saving
412-
# sis-queue posix : SiS with delayed comparison and deduplication
413-
#mail_attachment_fs = sis posix
414-
415-
# Hash format to use in attachment filenames. You can add any text and
416-
# variables: %{md4}, %{md5}, %{sha1}, %{sha256}, %{sha512}, %{size}.
417-
# Variables can be truncated, e.g. %{sha256:80} returns only first 80 bits
418-
#mail_attachment_hash = %{sha1}
419-
420405
# Settings to control adding $HasAttachment or $HasNoAttachment keywords.
421406
# By default, all MIME parts with Content-Disposition=attachment, or inlines
422407
# with filename parameter are consired attachments.

0 commit comments

Comments
 (0)