1 ===================== |
|
2 Dovecot configuration |
|
3 ===================== |
|
4 This page describes in short how to configure Dovecot. |
|
5 |
|
6 If you are upgrading your Dovecot installation from v1.\ **1**.x to |
|
7 v1.\ **2**.x or v\ **1**.x to v\ **2**.x, you should also read Upgrading_ |
|
8 in the `Dovecot wiki`_. |
|
9 |
|
10 Dovecot v1.x |
|
11 ------------ |
|
12 This setup uses two configuration files. |
|
13 :file:`dovecot.conf`, the MainConfig_ of the Dovecot server and |
|
14 :file:`dovecot-sql.conf`, containing the settings for passdb_ and userdb_ |
|
15 lookups. |
|
16 For more details see also `AuthDatabase/SQL`_ in the Dovecot wiki. |
|
17 |
|
18 dovecot.conf |
|
19 ^^^^^^^^^^^^ |
|
20 The following configuration example can be used as complete configuration |
|
21 file. You can also adjust your existing settings. |
|
22 Use :command:`dovecot -n | head -n 1` to locate your :file:`dovecot.conf`. |
|
23 |
|
24 .. note:: Please modify the `postmaster_address` to meet your specific needs. |
|
25 |
|
26 .. code-block:: text |
|
27 :emphasize-lines: 7 |
|
28 |
|
29 # all your other settings |
|
30 #disable_plaintext_auth = no |
|
31 mail_location = maildir:~/Maildir |
|
32 first_valid_uid = 70000 |
|
33 first_valid_gid = 70000 |
|
34 protocol lda { |
|
35 postmaster_address = postmaster@YOUR-DOMAIN.TLD |
|
36 # uncomment this to use server side filtering (Dovecot v1.0.x/v1.1.x) |
|
37 #mail_plugins = cmusieve |
|
38 # uncomment this to use server side filtering (Dovecot v1.2.x) |
|
39 #mail_plugins = sieve |
|
40 } |
|
41 protocol pop3 { |
|
42 pop3_uidl_format = %08Xu%08Xv |
|
43 } |
|
44 # uncomment this to use the ManageSieve protocol, if supported by your installation |
|
45 #protocol managesieve { |
|
46 # # only valid with Dovecot v1.0.x/v1.1.x. |
|
47 # # see also: http://wiki.dovecot.org/ManageSieve/Configuration#v1.0.2BAC8-v1.1 |
|
48 # sieve = ~/.dovecot.sieve |
|
49 # sieve_storage = ~/sieve |
|
50 #} |
|
51 auth default { |
|
52 mechanisms = cram-md5 login plain |
|
53 passdb sql { |
|
54 args = /etc/dovecot/dovecot-sql.conf |
|
55 } |
|
56 userdb sql { |
|
57 args = /etc/dovecot/dovecot-sql.conf |
|
58 } |
|
59 user = doveauth |
|
60 socket listen { |
|
61 master { |
|
62 path = /var/run/dovecot/auth-master |
|
63 mode = 0600 |
|
64 } |
|
65 client { |
|
66 path = /var/spool/postfix/private/dovecot-auth |
|
67 mode = 0660 |
|
68 user = postfix |
|
69 group = postfix |
|
70 } |
|
71 } |
|
72 } |
|
73 # uncomment this if you use the ManageSieve protocol with Dovecot v1.2.x |
|
74 #plugin { |
|
75 # # Sieve and ManageSieve settings |
|
76 # # see also: http://wiki.dovecot.org/ManageSieve/Configuration#v1.2 |
|
77 # sieve = ~/.dovecot.sieve |
|
78 # sieve_dir = ~/sieve |
|
79 #} |
|
80 |
|
81 |
|
82 .. _dovecot-sql-conf: |
|
83 |
|
84 dovecot-sql.conf |
|
85 ^^^^^^^^^^^^^^^^ |
|
86 This lines contains all information that are required by Dovecot to access |
|
87 the database and to do the lookups in passdb and userdb. |
|
88 |
|
89 .. code-block:: text |
|
90 |
|
91 driver = pgsql |
|
92 connect = host=localhost dbname=mailsys user=dovecot password=$Dovecot_PASS |
|
93 default_pass_scheme = CRAM-MD5 |
|
94 password_query = SELECT userid AS "user", password FROM dovecotpassword('%Ln', '%Ld') WHERE %Ls |
|
95 user_query = SELECT home, uid, gid, mail FROM dovecotuser('%Ln', '%Ld') |
|
96 |
|
97 Dovecot v2.x |
|
98 ------------ |
|
99 Beginning with Dovecot version 2.0 the configuration was split into multiple |
|
100 files. |
|
101 It isn't required to use multiple configuration files. |
|
102 :file:`dovecot.conf` is still the most important configuration file. |
|
103 Use the command :command:`doveconf -n | head -n 1` to locate your |
|
104 :file:`dovecot.conf`. |
|
105 You could put all settings in your :file:`dovecot.conf`. |
|
106 You can also include multiple files into your :file:`dovecot.conf`. |
|
107 |
|
108 I personally prefer it to comment out most of the :file:`dovecot.conf` |
|
109 and include only my :file:`local.conf`, which contains all the necessary |
|
110 settings. |
|
111 You can download my :download:`local.conf <../_static/local.conf>` and use |
|
112 it in your setup. |
|
113 |
|
114 If you want to use multiple configuration files, you have to apply the |
|
115 following settings to the configuration files mentioned down below. |
|
116 Everything that isn't mentioned, was commented out. |
|
117 |
|
118 .. _dovecot2.conf: |
|
119 |
|
120 dovecot.conf |
|
121 ^^^^^^^^^^^^ |
|
122 .. code-block:: text |
|
123 |
|
124 protocols = imap lmtp |
|
125 # uncomment if your users should be able to manage their sieve scripts |
|
126 #protocols = imap lmtp sieve |
|
127 |
|
128 # uncomment if you want to use the quota plugin |
|
129 #dict { |
|
130 # quota = pgsql:/usr/local/etc/dovecot/dovecot-dict-sql.conf.ext |
|
131 #} |
|
132 |
|
133 See also :ref:`dovecot-dict-sql-conf-ext` below. |
|
134 |
|
135 .. warning:: Adjust the paths of the :file:`dovecot-dict-sql.conf.ext` |
|
136 (above) and :file:`dovecot-sql.conf.ext` (below) files to suit your needs. |
|
137 |
|
138 |
|
139 .. _conf-d-10-auth-conf: |
|
140 |
|
141 conf.d/10-auth.conf |
|
142 ^^^^^^^^^^^^^^^^^^^ |
|
143 .. code-block:: text |
|
144 |
|
145 auth_mechanisms = plain login cram-md5 |
|
146 passdb { |
|
147 driver = sql |
|
148 args = /usr/local/etc/dovecot/dovecot-sql.conf.ext |
|
149 } |
|
150 userdb { |
|
151 driver = sql |
|
152 args = /usr/local/etc/dovecot/dovecot-sql.conf.ext |
|
153 } |
|
154 #!include auth-system.conf.ext |
|
155 |
|
156 See also :ref:`dovecot-sql-conf-ext` below. |
|
157 |
|
158 |
|
159 conf.d/10-mail.conf |
|
160 ^^^^^^^^^^^^^^^^^^^ |
|
161 .. code-block:: text |
|
162 |
|
163 first_valid_gid = 70000 |
|
164 first_valid_uid = 70000 |
|
165 mail_access_groups = dovemail |
|
166 mail_location = maildir:~/Maildir |
|
167 |
|
168 # uncomment if you want to use the quota plugin |
|
169 #mail_plugins = quota |
|
170 |
|
171 .. _conf-d-10-master.conf: |
|
172 |
|
173 conf.d/10-master.conf |
|
174 ^^^^^^^^^^^^^^^^^^^^^ |
|
175 .. code-block:: text |
|
176 |
|
177 # if you don't want to use secure imap, you have to disable the imaps listener |
|
178 ##service imap-login { |
|
179 ## inet_listener imaps { |
|
180 ## port = 0 |
|
181 ## } |
|
182 ##} |
|
183 |
|
184 service lmtp { |
|
185 unix_listener /var/spool/postfix/private/dovecot-lmtp { |
|
186 user = postfix |
|
187 group = postfix |
|
188 mode = 0600 |
|
189 } |
|
190 } |
|
191 |
|
192 service auth { |
|
193 user = doveauth |
|
194 unix_listener auth-userdb { |
|
195 } |
|
196 unix_listener /var/spool/postfix/private/dovecot-auth { |
|
197 user = postfix |
|
198 group = postfix |
|
199 mode = 0600 |
|
200 } |
|
201 } |
|
202 |
|
203 service auth-worker { |
|
204 unix_listener auth-worker { |
|
205 user = doveauth |
|
206 group = $default_internal_user |
|
207 mode = 0660 |
|
208 } |
|
209 user = doveauth |
|
210 } |
|
211 |
|
212 service dict { |
|
213 unix_listener dict { |
|
214 group = dovemail |
|
215 mode = 0660 |
|
216 } |
|
217 } |
|
218 |
|
219 conf.d/10-ssl.conf |
|
220 ^^^^^^^^^^^^^^^^^^ |
|
221 .. code-block:: text |
|
222 |
|
223 # SSL/TLS support: yes, no, required. <doc/wiki/SSL.txt> |
|
224 #ssl = yes |
|
225 |
|
226 ssl_cert = </etc/ssl/certs/dovecot.pem |
|
227 ssl_key = </etc/ssl/private/dovecot.pem |
|
228 |
|
229 # if you want to disable SSL/TLS, you have set 'ssl = no' and disable the |
|
230 # imaps listener in conf.d/10-master.conf |
|
231 |
|
232 conf.d/15-lda.conf |
|
233 ^^^^^^^^^^^^^^^^^^ |
|
234 .. note:: Please modify the `postmaster_address` to meet your specific needs. |
|
235 |
|
236 .. code-block:: text |
|
237 :emphasize-lines: 1 |
|
238 |
|
239 postmaster_address = postmaster@YOUR-DOMAIN.TLD |
|
240 recipient_delimiter = + |
|
241 protocol lda { |
|
242 # uncomment if you want to use the quota plugin |
|
243 #mail_plugins = $mail_plugins |
|
244 # uncomment if you want to use the quota and sieve plugins |
|
245 #mail_plugins = $mail_plugins sieve |
|
246 } |
|
247 |
|
248 conf.d/20-imap.conf |
|
249 ^^^^^^^^^^^^^^^^^^^ |
|
250 .. code-block:: text |
|
251 |
|
252 protocol imap { |
|
253 # uncomment if you want to use the quota plugin |
|
254 #mail_plugins = $mail_plugins imap_quota |
|
255 } |
|
256 |
|
257 conf.d/20-lmtp.conf |
|
258 ^^^^^^^^^^^^^^^^^^^ |
|
259 .. code-block:: text |
|
260 |
|
261 protocol lmtp { |
|
262 # uncomment if you want to use the quota plugin |
|
263 #mail_plugins = $mail_plugins |
|
264 # uncomment if you want to use the quota and sieve plugins |
|
265 #mail_plugins = $mail_plugins sieve |
|
266 } |
|
267 |
|
268 conf.d/90-quota.conf |
|
269 ^^^^^^^^^^^^^^^^^^^^ |
|
270 .. code-block:: text |
|
271 |
|
272 # uncomment if you want to use the quota plugin |
|
273 #plugin { |
|
274 # quota = dict:user:%{uid}:proxy::quota |
|
275 # quota_rule = *:storage=0:messages=0 |
|
276 # quota_rule2 = Trash:storage=+100M |
|
277 #} |
|
278 |
|
279 conf.d/90-sieve.conf |
|
280 ^^^^^^^^^^^^^^^^^^^^ |
|
281 .. code-block:: text |
|
282 |
|
283 # uncomment if you want to use sieve (and maybe managesieve) |
|
284 #plugin { |
|
285 # recipient_delimiter = + |
|
286 # sieve = ~/.dovecot.sieve |
|
287 # sieve_dir = ~/sieve |
|
288 #} |
|
289 |
|
290 |
|
291 .. _dovecot-sql-conf-ext: |
|
292 |
|
293 dovecot-sql.conf.ext |
|
294 ^^^^^^^^^^^^^^^^^^^^ |
|
295 This file was referenced above in the `passdb` and `userdb` sections of |
|
296 :ref:`conf-d-10-auth-conf`. |
|
297 |
|
298 .. code-block:: text |
|
299 |
|
300 driver = pgsql |
|
301 connect = host=localhost dbname=mailsys user=dovecot password=$Dovecot_PASS |
|
302 |
|
303 password_query = \ |
|
304 SELECT userid AS "user", password FROM dovecotpassword('%Ln', '%Ld') WHERE %Ls |
|
305 |
|
306 # uncomment this user_query if you want to use the quota plugin |
|
307 #user_query = \ |
|
308 # SELECT home, uid, gid, mail, quota_rule FROM dovecotquotauser('%Ln', '%Ld') |
|
309 |
|
310 # otherwise uncomment the following user_query |
|
311 #user_query = SELECT home, uid, gid, mail FROM dovecotuser('%Ln', '%Ld') |
|
312 |
|
313 iterate_query = \ |
|
314 SELECT local_part AS username, domain_name.domainname AS domain \ |
|
315 FROM users \ |
|
316 LEFT JOIN domain_data USING (gid) \ |
|
317 LEFT JOIN domain_name USING (gid) |
|
318 |
|
319 |
|
320 .. _dovecot-dict-sql-conf-ext: |
|
321 |
|
322 dovecot-dict-sql.conf.ext |
|
323 ^^^^^^^^^^^^^^^^^^^^^^^^^ |
|
324 If you want to use the quota plugin add this lines to your |
|
325 :file:`dovecot-dict-sql.conf.ext`. |
|
326 This file was referenced in the `dict` section of :ref:`dovecot2.conf`. |
|
327 |
|
328 .. code-block:: text |
|
329 |
|
330 connect = host=localhost dbname=mailsys user=dovecot password=$Dovecot_PASS |
|
331 map { |
|
332 pattern = priv/quota/storage |
|
333 table = userquota |
|
334 username_field = uid |
|
335 value_field = bytes |
|
336 } |
|
337 map { |
|
338 pattern = priv/quota/messages |
|
339 table = userquota |
|
340 username_field = uid |
|
341 value_field = messages |
|
342 } |
|
343 |
|
344 .. include:: ../ext_references.rst |
|