dovecot.conf.j2 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309
  1. auth_mechanisms = plain login
  2. #mail_debug = yes
  3. #auth_debug = yes
  4. #log_debug = category=fts-flatcurve # Activate Logging for Flatcurve FTS Searchings
  5. log_path = syslog
  6. disable_plaintext_auth = yes
  7. # Uncomment on NFS share
  8. #mmap_disable = yes
  9. #mail_fsync = always
  10. #mail_nfs_index = yes
  11. #mail_nfs_storage = yes
  12. login_log_format_elements = "user=<%u> method=%m rip=%r lip=%l mpid=%e %c %k"
  13. mail_home = /var/vmail/%d/%n
  14. mail_location = maildir:~/
  15. mail_plugins = </etc/dovecot/mail_plugins
  16. mail_attachment_fs = crypt:set_prefix=mail_crypt_global:posix:
  17. mail_attachment_dir = /var/attachments
  18. mail_attachment_min_size = 128k
  19. # Significantly speeds up very large mailboxes, but is only safe to enable if
  20. # you do not manually modify the files in the `cur` directories in
  21. # mailcowdockerized_vmail-vol-1.
  22. # https://docs.mailcow.email/manual-guides/Dovecot/u_e-dovecot-performance/
  23. maildir_very_dirty_syncs = yes
  24. # Dovecot 2.2
  25. #ssl_protocols = !SSLv3
  26. # Dovecot 2.3
  27. ssl_min_protocol = TLSv1.2
  28. ssl_prefer_server_ciphers = yes
  29. ssl_cipher_list = ALL:!ADH:!LOW:!SSLv2:!SSLv3:!EXP:!aNULL:!eNULL:!3DES:!MD5:!PSK:!DSS:!RC4:!SEED:!IDEA:+HIGH:+MEDIUM
  30. # Default in Dovecot 2.3
  31. ssl_options = no_compression no_ticket
  32. # New in Dovecot 2.3
  33. ssl_dh = </etc/ssl/mail/dhparams.pem
  34. # Dovecot 2.2
  35. #ssl_dh_parameters_length = 2048
  36. log_timestamp = "%Y-%m-%d %H:%M:%S "
  37. recipient_delimiter = +
  38. auth_master_user_separator = *
  39. mail_shared_explicit_inbox = yes
  40. mail_prefetch_count = 30
  41. passdb {
  42. driver = lua
  43. args = file=/etc/dovecot/auth/passwd-verify.lua blocking=yes cache_key=%s:%u:%w
  44. result_success = return-ok
  45. result_failure = continue
  46. result_internalfail = continue
  47. }
  48. # try a master passwd
  49. passdb {
  50. driver = passwd-file
  51. args = /etc/dovecot/dovecot-master.passwd
  52. master = yes
  53. skip = authenticated
  54. }
  55. # check for regular password - if empty (e.g. force-passwd-reset), previous pass=yes passdbs also fail
  56. # a return of the following passdb is mandatory
  57. passdb {
  58. driver = lua
  59. args = file=/etc/dovecot/auth/passwd-verify.lua blocking=yes
  60. }
  61. # Set doveadm_password=your-secret-password in data/conf/dovecot/extra.conf (create if missing)
  62. service doveadm {
  63. inet_listener {
  64. port = 12345
  65. }
  66. vsz_limit=2048 MB
  67. }
  68. {% include 'dovecot.folders.conf.j2' %}
  69. protocols = imap sieve lmtp pop3
  70. service dict {
  71. unix_listener dict {
  72. mode = 0660
  73. user = vmail
  74. group = vmail
  75. }
  76. }
  77. service log {
  78. user = dovenull
  79. }
  80. service config {
  81. unix_listener config {
  82. user = root
  83. group = vmail
  84. mode = 0660
  85. }
  86. }
  87. service auth {
  88. inet_listener auth-inet {
  89. port = 10001
  90. }
  91. unix_listener auth-master {
  92. mode = 0600
  93. user = vmail
  94. }
  95. unix_listener auth-userdb {
  96. mode = 0600
  97. user = vmail
  98. }
  99. vsz_limit = 2G
  100. }
  101. service managesieve-login {
  102. inet_listener sieve {
  103. port = 4190
  104. }
  105. inet_listener sieve_haproxy {
  106. port = 14190
  107. haproxy = yes
  108. }
  109. service_count = 1
  110. process_min_avail = 2
  111. vsz_limit = 1G
  112. }
  113. service imap-login {
  114. service_count = 1
  115. process_min_avail = 2
  116. process_limit = 10000
  117. vsz_limit = 1G
  118. user = dovenull
  119. inet_listener imap_haproxy {
  120. port = 10143
  121. haproxy = yes
  122. }
  123. inet_listener imaps_haproxy {
  124. port = 10993
  125. ssl = yes
  126. haproxy = yes
  127. }
  128. }
  129. service pop3-login {
  130. service_count = 1
  131. process_min_avail = 1
  132. vsz_limit = 1G
  133. inet_listener pop3_haproxy {
  134. port = 10110
  135. haproxy = yes
  136. }
  137. inet_listener pop3s_haproxy {
  138. port = 10995
  139. ssl = yes
  140. haproxy = yes
  141. }
  142. }
  143. service imap {
  144. executable = imap
  145. user = vmail
  146. vsz_limit = 1G
  147. }
  148. service managesieve {
  149. process_limit = 256
  150. }
  151. service lmtp {
  152. inet_listener lmtp-inet {
  153. port = 24
  154. }
  155. user = vmail
  156. }
  157. listen = *,[::]
  158. ssl_cert = </etc/ssl/mail/cert.pem
  159. ssl_key = </etc/ssl/mail/key.pem
  160. userdb {
  161. driver = passwd-file
  162. args = /etc/dovecot/dovecot-master.userdb
  163. }
  164. userdb {
  165. args = /etc/dovecot/sql/dovecot-dict-sql-userdb.conf
  166. driver = sql
  167. skip = found
  168. }
  169. protocol imap {
  170. mail_plugins = </etc/dovecot/mail_plugins_imap
  171. imap_metadata = yes
  172. }
  173. mail_attribute_dict = file:%h/dovecot-attributes
  174. protocol lmtp {
  175. mail_plugins = </etc/dovecot/mail_plugins_lmtp
  176. auth_socket_path = /var/run/dovecot/auth-master
  177. }
  178. protocol sieve {
  179. managesieve_logout_format = bytes=%i/%o
  180. }
  181. plugin {
  182. # Allow "any" or "authenticated" to be used in ACLs
  183. acl_anyone = {{ ACL_ANYONE }}
  184. acl_shared_dict = file:/var/vmail/shared-mailboxes.db
  185. acl = vfile
  186. acl_user = %u
  187. quota = dict:Userquota::proxy::sqlquota
  188. quota_rule2 = Trash:storage=+100%%
  189. sieve = /var/vmail/sieve/%u.sieve
  190. sieve_plugins = sieve_imapsieve sieve_extprograms
  191. sieve_vacation_send_from_recipient = yes
  192. sieve_redirect_envelope_from = recipient
  193. # From elsewhere to Spam folder
  194. imapsieve_mailbox1_name = Junk
  195. imapsieve_mailbox1_causes = COPY
  196. imapsieve_mailbox1_before = file:/usr/lib/dovecot/sieve/report-spam.sieve
  197. # END
  198. # From Spam folder to elsewhere
  199. imapsieve_mailbox2_name = *
  200. imapsieve_mailbox2_from = Junk
  201. imapsieve_mailbox2_causes = COPY
  202. imapsieve_mailbox2_before = file:/usr/lib/dovecot/sieve/report-ham.sieve
  203. # END
  204. master_user = %u
  205. quota_warning = storage=95%% quota-warning 95 %u
  206. quota_warning2 = storage=80%% quota-warning 80 %u
  207. sieve_pipe_bin_dir = /usr/lib/dovecot/sieve
  208. sieve_global_extensions = +vnd.dovecot.pipe +vnd.dovecot.execute
  209. sieve_extensions = +notify +imapflags +vacation-seconds +editheader
  210. sieve_max_script_size = 1M
  211. sieve_max_redirects = 100
  212. sieve_max_actions = 101
  213. sieve_quota_max_scripts = 0
  214. sieve_quota_max_storage = 0
  215. listescape_char = "\\"
  216. sieve_vacation_min_period = 5s
  217. sieve_vacation_max_period = 0
  218. sieve_vacation_default_period = 60s
  219. sieve_before = /var/vmail/sieve/global_sieve_before.sieve
  220. sieve_before2 = dict:proxy::sieve_before;name=active;bindir=/var/vmail/sieve_before_bindir
  221. sieve_after = dict:proxy::sieve_after;name=active;bindir=/var/vmail/sieve_after_bindir
  222. sieve_after2 = /var/vmail/sieve/global_sieve_after.sieve
  223. sieve_duplicate_default_period = 1m
  224. sieve_duplicate_max_period = 7d
  225. # -- Global keys
  226. mail_crypt_global_private_key = </mail_crypt/ecprivkey.pem
  227. mail_crypt_global_public_key = </mail_crypt/ecpubkey.pem
  228. mail_crypt_save_version = 2
  229. # Enable compression while saving, lz4 Dovecot v2.3.17+
  230. zlib_save = lz4
  231. mail_log_events = delete undelete expunge copy mailbox_delete mailbox_rename
  232. mail_log_fields = uid box msgid size
  233. mail_log_cached_only = yes
  234. # Try set mail_replica
  235. {% include 'mail_replica.conf.j2' %}
  236. }
  237. service quota-warning {
  238. executable = script /usr/local/bin/quota_notify.py
  239. # use some unprivileged user for executing the quota warnings
  240. user = vmail
  241. unix_listener quota-warning {
  242. user = vmail
  243. }
  244. }
  245. dict {
  246. sqlquota = mysql:/etc/dovecot/sql/dovecot-dict-sql-quota.conf
  247. sieve_after = mysql:/etc/dovecot/sql/dovecot-dict-sql-sieve_after.conf
  248. sieve_before = mysql:/etc/dovecot/sql/dovecot-dict-sql-sieve_before.conf
  249. }
  250. remote 127.0.0.1 {
  251. disable_plaintext_auth = no
  252. }
  253. submission_host = postfix:588
  254. mail_max_userip_connections = 500
  255. service stats {
  256. unix_listener stats-writer {
  257. mode = 0660
  258. user = vmail
  259. }
  260. }
  261. imap_max_line_length = 2 M
  262. auth_cache_verify_password_with_worker = yes
  263. auth_cache_negative_ttl = 60s
  264. auth_cache_ttl = 300s
  265. auth_cache_size = 10M
  266. auth_verbose_passwords = sha1:6
  267. service replicator {
  268. process_min_avail = 1
  269. }
  270. service aggregator {
  271. fifo_listener replication-notify-fifo {
  272. user = vmail
  273. }
  274. unix_listener replication-notify {
  275. user = vmail
  276. }
  277. }
  278. service replicator {
  279. unix_listener replicator-doveadm {
  280. mode = 0666
  281. }
  282. }
  283. replication_max_conns = 10
  284. doveadm_port = 12345
  285. replication_dsync_parameters = -d -l 30 -U -n INBOX
  286. {% include 'sogo_trusted_ip.conf.j2' %}
  287. {% include 'shared_namespace.conf.j2' %}
  288. {% include 'fts.conf.j2' %}
  289. {% include 'sni.conf.j2' %}
  290. # <Includes>
  291. !include_try /etc/dovecot/extra.conf
  292. # </Includes>
  293. default_client_limit = 10400
  294. default_vsz_limit = 1024 M