10-mail.conf.erb 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360
  1. # Generated by Chef
  2. ##
  3. ## Mailbox locations and namespaces
  4. ##
  5. # Location for users' mailboxes. The default is empty, which means that Dovecot
  6. # tries to find the mailboxes automatically. This won't work if the user
  7. # doesn't yet have any mail, so you should explicitly tell Dovecot the full
  8. # location.
  9. #
  10. # If you're using mbox, giving a path to the INBOX file (eg. /var/mail/%u)
  11. # isn't enough. You'll also need to tell Dovecot where the other mailboxes are
  12. # kept. This is called the "root mail directory", and it must be the first
  13. # path given in the mail_location setting.
  14. #
  15. # There are a few special variables you can use, eg.:
  16. #
  17. # %u - username
  18. # %n - user part in user@domain, same as %u if there's no domain
  19. # %d - domain part in user@domain, empty if there's no domain
  20. # %h - home directory
  21. #
  22. # See doc/wiki/Variables.txt for full list. Some examples:
  23. #
  24. # mail_location = maildir:~/Maildir
  25. # mail_location = mbox:~/mail:INBOX=/var/mail/%u
  26. # mail_location = mbox:/var/mail/%d/%1n/%n:INDEX=/var/indexes/%d/%1n/%n
  27. #
  28. # <doc/wiki/MailLocation.txt>
  29. #
  30. <%= Dovecot::Conf.attribute(@conf, 'mail_location') %>
  31. # If you need to set multiple mailbox locations or want to change default
  32. # namespace settings, you can do it by defining namespace sections.
  33. #
  34. # You can have private, shared and public namespaces. Private namespaces
  35. # are for user's personal mails. Shared namespaces are for accessing other
  36. # users' mailboxes that have been shared. Public namespaces are for shared
  37. # mailboxes that are managed by sysadmin. If you create any shared or public
  38. # namespaces you'll typically want to enable ACL plugin also, otherwise all
  39. # users can access all the shared mailboxes, assuming they have permissions
  40. # on filesystem level to do so.
  41. #
  42. # REMEMBER: If you add any namespaces, the default namespace must be added
  43. # explicitly, ie. mail_location does nothing unless you have a namespace
  44. # without a location setting. Default namespace is simply done by having a
  45. # namespace with empty prefix.
  46. <% if @namespaces.kind_of?(Array) and @namespaces.length > 0 -%>
  47. <% @namespaces.each do |ns| -%>
  48. <%= Dovecot::Conf.namespace(ns) %>
  49. <% end -%>
  50. <% else -%>
  51. #namespace {
  52. # Namespace type: private, shared or public
  53. #type = private
  54. # Hierarchy separator to use. You should use the same separator for all
  55. # namespaces or some clients get confused. '/' is usually a good one.
  56. # The default however depends on the underlying mail storage format.
  57. #separator =
  58. # Prefix required to access this namespace. This needs to be different for
  59. # all namespaces. For example "Public/".
  60. #prefix =
  61. # Physical location of the mailbox. This is in same format as
  62. # mail_location, which is also the default for it.
  63. #location =
  64. # There can be only one INBOX, and this setting defines which namespace
  65. # has it.
  66. #inbox = no
  67. # If namespace is hidden, it's not advertised to clients via NAMESPACE
  68. # extension. You'll most likely also want to set list=no. This is mostly
  69. # useful when converting from another server with different namespaces which
  70. # you want to deprecate but still keep working. For example you can create
  71. # hidden namespaces with prefixes "~/mail/", "~%u/mail/" and "mail/".
  72. #hidden = no
  73. # Show the mailboxes under this namespace with LIST command. This makes the
  74. # namespace visible for clients that don't support NAMESPACE extension.
  75. # "children" value lists child mailboxes, but hides the namespace prefix.
  76. #list = yes
  77. # Namespace handles its own subscriptions. If set to "no", the parent
  78. # namespace handles them (empty prefix should always have this as "yes")
  79. #subscriptions = yes
  80. #}
  81. <% end -%>
  82. # Example shared namespace configuration
  83. #namespace {
  84. #type = shared
  85. #separator = /
  86. # Mailboxes are visible under "shared/user@domain/"
  87. # %%n, %%d and %%u are expanded to the destination user.
  88. #prefix = shared/%%u/
  89. # Mail location for other users' mailboxes. Note that %variables and ~/
  90. # expands to the logged in user's data. %%n, %%d, %%u and %%h expand to the
  91. # destination user's data.
  92. #location = maildir:%%h/Maildir:INDEX=~/Maildir/shared/%%u
  93. # Use the default namespace for saving subscriptions.
  94. #subscriptions = no
  95. # List the shared/ namespace only if there are visible shared mailboxes.
  96. #list = children
  97. #}
  98. # System user and group used to access mails. If you use multiple, userdb
  99. # can override these by returning uid or gid fields. You can use either numbers
  100. # or names. <doc/wiki/UserIds.txt>
  101. <%= Dovecot::Conf.attribute(@conf, 'mail_uid') %>
  102. <%= Dovecot::Conf.attribute(@conf, 'mail_gid') %>
  103. # Group to enable temporarily for privileged operations. Currently this is
  104. # used only with INBOX when either its initial creation or dotlocking fails.
  105. # Typically this is set to "mail" to give access to /var/mail.
  106. <%= Dovecot::Conf.attribute(@conf, 'mail_privileged_group') %>
  107. # Grant access to these supplementary groups for mail processes. Typically
  108. # these are used to set up access to shared mailboxes. Note that it may be
  109. # dangerous to set these if users can create symlinks (e.g. if "mail" group is
  110. # set here, ln -s /var/mail ~/mail/var could allow a user to delete others'
  111. # mailboxes, or ln -s /secret/shared/box ~/mail/mybox would allow reading it).
  112. <%= Dovecot::Conf.attribute(@conf, 'mail_access_groups') %>
  113. # Allow full filesystem access to clients. There's no access checks other than
  114. # what the operating system does for the active UID/GID. It works with both
  115. # maildir and mboxes, allowing you to prefix mailboxes names with eg. /path/
  116. # or ~user/.
  117. <%= Dovecot::Conf.attribute(@conf, 'mail_full_filesystem_access', false) %>
  118. ##
  119. ## Mail processes
  120. ##
  121. # Don't use mmap() at all. This is required if you store indexes to shared
  122. # filesystems (NFS or clustered filesystem).
  123. <%= Dovecot::Conf.attribute(@conf, 'mmap_disable', false) %>
  124. # Rely on O_EXCL to work when creating dotlock files. NFS supports O_EXCL
  125. # since version 3, so this should be safe to use nowadays by default.
  126. <%= Dovecot::Conf.attribute(@conf, 'dotlock_use_excl', true) %>
  127. # When to use fsync() or fdatasync() calls:
  128. # optimized (default): Whenever necessary to avoid losing important data
  129. # always: Useful with e.g. NFS when write()s are delayed
  130. # never: Never use it (best performance, but crashes can lose data)
  131. <%= Dovecot::Conf.attribute(@conf, 'mail_fsync', 'optimized') %>
  132. # Mail storage exists in NFS. Set this to yes to make Dovecot flush NFS caches
  133. # whenever needed. If you're using only a single mail server this isn't needed.
  134. <%= Dovecot::Conf.attribute(@conf, 'mail_nfs_storage', false) %>
  135. # Mail index files also exist in NFS. Setting this to yes requires
  136. # mmap_disable=yes and fsync_disable=no.
  137. <%= Dovecot::Conf.attribute(@conf, 'mail_nfs_index', false) %>
  138. # Locking method for index files. Alternatives are fcntl, flock and dotlock.
  139. # Dotlocking uses some tricks which may create more disk I/O than other locking
  140. # methods. NFS users: flock doesn't work, remember to change mmap_disable.
  141. <%= Dovecot::Conf.attribute(@conf, 'lock_method', 'fcntl') %>
  142. # Directory in which LDA/LMTP temporarily stores incoming mails >128 kB.
  143. <%= Dovecot::Conf.attribute(@conf, 'mail_temp_dir', '/tmp') %>
  144. # Valid UID range for users, defaults to 500 and above. This is mostly
  145. # to make sure that users can't log in as daemons or other system users.
  146. # Note that denying root logins is hardcoded to dovecot binary and can't
  147. # be done even if first_valid_uid is set to 0.
  148. <%= Dovecot::Conf.attribute(@conf, 'first_valid_uid', 500) %>
  149. <%= Dovecot::Conf.attribute(@conf, 'last_valid_uid', 0) %>
  150. # Valid GID range for users, defaults to non-root/wheel. Users having
  151. # non-valid GID as primary group ID aren't allowed to log in. If user
  152. # belongs to supplementary groups with non-valid GIDs, those groups are
  153. # not set.
  154. <%= Dovecot::Conf.attribute(@conf, 'first_valid_gid', 1) %>
  155. <%= Dovecot::Conf.attribute(@conf, 'last_valid_gid', 0) %>
  156. # Maximum allowed length for mail keyword name. It's only forced when trying
  157. # to create new keywords.
  158. <%= Dovecot::Conf.attribute(@conf, 'mail_max_keyword_length', 50) %>
  159. # ':' separated list of directories under which chrooting is allowed for mail
  160. # processes (ie. /var/mail will allow chrooting to /var/mail/foo/bar too).
  161. # This setting doesn't affect login_chroot, mail_chroot or auth chroot
  162. # settings. If this setting is empty, "/./" in home dirs are ignored.
  163. # WARNING: Never add directories here which local users can modify, that
  164. # may lead to root exploit. Usually this should be done only if you don't
  165. # allow shell access for users. <doc/wiki/Chrooting.txt>
  166. <%= Dovecot::Conf.attribute(@conf, 'valid_chroot_dirs') %>
  167. # Default chroot directory for mail processes. This can be overridden for
  168. # specific users in user database by giving /./ in user's home directory
  169. # (eg. /home/./user chroots into /home). Note that usually there is no real
  170. # need to do chrooting, Dovecot doesn't allow users to access files outside
  171. # their mail directory anyway. If your home directories are prefixed with
  172. # the chroot directory, append "/." to mail_chroot. <doc/wiki/Chrooting.txt>
  173. <%= Dovecot::Conf.attribute(@conf, 'mail_chroot') %>
  174. # UNIX socket path to master authentication server to find users.
  175. # This is used by imap (for shared users) and lda.
  176. <%= Dovecot::Conf.attribute(@conf, 'auth_socket_path', '/var/run/dovecot/auth-userdb') %>
  177. # Directory where to look up mail plugins.
  178. <%= case node['platform']
  179. when 'redhat','centos','scientific','fedora','suse','amazon' then
  180. Dovecot::Conf.attribute(@conf, 'mail_plugin_dir', '/usr/lib/dovecot')
  181. # when 'debian', 'ubuntu' then
  182. else
  183. Dovecot::Conf.attribute(@conf, 'mail_plugin_dir', '/usr/lib/dovecot/modules')
  184. end
  185. %>
  186. # Space separated list of plugins to load for all services. Plugins specific to
  187. # IMAP, LDA, etc. are added to this list in their own .conf files.
  188. <%= Dovecot::Conf.attribute(@conf, 'mail_plugins') %>
  189. ##
  190. ## Mailbox handling optimizations
  191. ##
  192. # The minimum number of mails in a mailbox before updates are done to cache
  193. # file. This allows optimizing Dovecot's behavior to do less disk writes at
  194. # the cost of more disk reads.
  195. <%= Dovecot::Conf.attribute(@conf, 'mail_cache_min_mail_count', 0) %>
  196. # When IDLE command is running, mailbox is checked once in a while to see if
  197. # there are any new mails or other changes. This setting defines the minimum
  198. # time to wait between those checks. Dovecot can also use dnotify, inotify and
  199. # kqueue to find out immediately when changes occur.
  200. <%= Dovecot::Conf.attribute(@conf, 'mailbox_idle_check_interval', '30 secs') %>
  201. # Save mails with CR+LF instead of plain LF. This makes sending those mails
  202. # take less CPU, especially with sendfile() syscall with Linux and FreeBSD.
  203. # But it also creates a bit more disk I/O which may just make it slower.
  204. # Also note that if other software reads the mboxes/maildirs, they may handle
  205. # the extra CRs wrong and cause problems.
  206. <%= Dovecot::Conf.attribute(@conf, 'mail_save_crlf', false) %>
  207. ##
  208. ## Maildir-specific settings
  209. ##
  210. # By default LIST command returns all entries in maildir beginning with a dot.
  211. # Enabling this option makes Dovecot return only entries which are directories.
  212. # This is done by stat()ing each entry, so it causes more disk I/O.
  213. # (For systems setting struct dirent->d_type, this check is free and it's
  214. # done always regardless of this setting)
  215. <%= Dovecot::Conf.attribute(@conf, 'maildir_stat_dirs', false) %>
  216. # When copying a message, do it with hard links whenever possible. This makes
  217. # the performance much better, and it's unlikely to have any side effects.
  218. <%= Dovecot::Conf.attribute(@conf, 'maildir_copy_with_hardlinks', true) %>
  219. # Assume Dovecot is the only MUA accessing Maildir: Scan cur/ directory only
  220. # when its mtime changes unexpectedly or when we can't find the mail otherwise.
  221. <%= Dovecot::Conf.attribute(@conf, 'maildir_very_dirty_syncs', false) %>
  222. ##
  223. ## mbox-specific settings
  224. ##
  225. # Which locking methods to use for locking mbox. There are four available:
  226. # dotlock: Create <mailbox>.lock file. This is the oldest and most NFS-safe
  227. # solution. If you want to use /var/mail/ like directory, the users
  228. # will need write access to that directory.
  229. # dotlock_try: Same as dotlock, but if it fails because of permissions or
  230. # because there isn't enough disk space, just skip it.
  231. # fcntl : Use this if possible. Works with NFS too if lockd is used.
  232. # flock : May not exist in all systems. Doesn't work with NFS.
  233. # lockf : May not exist in all systems. Doesn't work with NFS.
  234. #
  235. # You can use multiple locking methods; if you do the order they're declared
  236. # in is important to avoid deadlocks if other MTAs/MUAs are using multiple
  237. # locking methods as well. Some operating systems don't allow using some of
  238. # them simultaneously.
  239. <%= Dovecot::Conf.attribute(@conf, 'mbox_read_locks', 'fcntl') %>
  240. <%= Dovecot::Conf.attribute(@conf, 'mbox_write_locks', 'dotlock fcntl') %>
  241. # Maximum time to wait for lock (all of them) before aborting.
  242. <%= Dovecot::Conf.attribute(@conf, 'mbox_lock_timeout', '5 mins') %>
  243. # If dotlock exists but the mailbox isn't modified in any way, override the
  244. # lock file after this much time.
  245. <%= Dovecot::Conf.attribute(@conf, 'mbox_dotlock_change_timeout', '2 mins') %>
  246. # When mbox changes unexpectedly we have to fully read it to find out what
  247. # changed. If the mbox is large this can take a long time. Since the change
  248. # is usually just a newly appended mail, it'd be faster to simply read the
  249. # new mails. If this setting is enabled, Dovecot does this but still safely
  250. # fallbacks to re-reading the whole mbox file whenever something in mbox isn't
  251. # how it's expected to be. The only real downside to this setting is that if
  252. # some other MUA changes message flags, Dovecot doesn't notice it immediately.
  253. # Note that a full sync is done with SELECT, EXAMINE, EXPUNGE and CHECK
  254. # commands.
  255. <%= Dovecot::Conf.attribute(@conf, 'mbox_dirty_syncs', true) %>
  256. # Like mbox_dirty_syncs, but don't do full syncs even with SELECT, EXAMINE,
  257. # EXPUNGE or CHECK commands. If this is set, mbox_dirty_syncs is ignored.
  258. <%= Dovecot::Conf.attribute(@conf, 'mbox_very_dirty_syncs', false) %>
  259. # Delay writing mbox headers until doing a full write sync (EXPUNGE and CHECK
  260. # commands and when closing the mailbox). This is especially useful for POP3
  261. # where clients often delete all mails. The downside is that our changes
  262. # aren't immediately visible to other MUAs.
  263. <%= Dovecot::Conf.attribute(@conf, 'mbox_lazy_writes', true) %>
  264. # If mbox size is smaller than this (e.g. 100k), don't write index files.
  265. # If an index file already exists it's still read, just not updated.
  266. <%= Dovecot::Conf.attribute(@conf, 'mbox_min_index_size', 0) %>
  267. ##
  268. ## mdbox-specific settings
  269. ##
  270. # Maximum dbox file size until it's rotated.
  271. <%= Dovecot::Conf.attribute(@conf, 'mdbox_rotate_size', '2M') %>
  272. # Maximum dbox file age until it's rotated. Typically in days. Day begins
  273. # from midnight, so 1d = today, 2d = yesterday, etc. 0 = check disabled.
  274. <%= Dovecot::Conf.attribute(@conf, 'mdbox_rotate_interval', 0) %>
  275. # When creating new mdbox files, immediately preallocate their size to
  276. # mdbox_rotate_size. This setting currently works only in Linux with some
  277. # filesystems (ext4, xfs).
  278. <%= Dovecot::Conf.attribute(@conf, 'mdbox_preallocate_space', false) %>
  279. ##
  280. ## Mail attachments
  281. ##
  282. # sdbox and mdbox support saving mail attachments to external files, which
  283. # also allows single instance storage for them. Other backends don't support
  284. # this for now.
  285. # WARNING: This feature hasn't been tested much yet. Use at your own risk.
  286. # Directory root where to store mail attachments. Disabled, if empty.
  287. #mail_attachment_dir =
  288. # Attachments smaller than this aren't saved externally. It's also possible to
  289. # write a plugin to disable saving specific attachments externally.
  290. <%= Dovecot::Conf.attribute(@conf, 'mail_attachment_min_size', '128k') %>
  291. # Filesystem backend to use for saving attachments:
  292. # posix : No SiS done by Dovecot (but this might help FS's own deduplication)
  293. # sis posix : SiS with immediate byte-by-byte comparison during saving
  294. # sis-queue posix : SiS with delayed comparison and deduplication
  295. <%= Dovecot::Conf.attribute(@conf, 'mail_attachment_fs', 'sis posix') %>
  296. # Hash format to use in attachment filenames. You can add any text and
  297. # variables: %{md4}, %{md5}, %{sha1}, %{sha256}, %{sha512}, %{size}.
  298. # Variables can be truncated, e.g. %{sha256:80} returns only first 80 bits
  299. <%= Dovecot::Conf.attribute(@conf, 'mail_attachment_hash', '%{sha1}') %>