Postfix & Dovecot Maildir Setup Guide
Postfix & Dovecot Maildir Setup Guide
? Virtual Mail hosting - Postfix and Dovecot using Mbox format with System
Accounts
? Virtual Mail hosting - Postfix and Dovecot using Maildir format without
system accounts
? Virtual Mail hosting - Postfix and Dovecot using Maildir format without
system accounts using MySQL
? Virtual Mail hosting - Postfix and Dovecot using Maildir format without
system accounts using LDAP
? Virtual Mail hosting (for ISP) - Postfix and Dovecot using Maildir format
without system accounts using LDAP with back-sql using MySQL
? Virtual Mail hosting (for ISP) - Postfix and Dovecot using Maildir format
without system accounts using LDAP with back-sql using postgresql
? Postfix Dovecot spamAssassin ClanAV amavisd-new squirrelmail
? Secure Postfix Mail Gateway
This document gives guidance for mail retrieval and sending using postfix and dovecot in
pop3. The setup described here uses maildir format for message storing and system
account for the mail users. All you need to change is your domain name since
configuration files are also attached at the end of this doc. ?
Building Postfix
When you download the postfix package from the http://www.postfix.org it comes as a
collection which is first subjected to 'tar' and then to compression. Hence first you have to
unzip the files using the following command in the terminal. In this example the files are
stored in the /usr/local/src directory.
$ gzip -d postfix-2.2.10.tar.gz
It will extract the files and then you have to use the following command.
Then a directory called postfix-2.2.10 will appear in you current directory (in this case in
the src directory). Then change the directory to postfix-2.2.10 using the following
command.
1
$ cd postfix-2.2.10
If you are intended to use the default parameters, then type
$ make
Installing Postfix
To install postfix you have to be the root user. There you need to create an account that
will own the postfix mailq and most of the processors. The account should not permit
logins and doesn't need either a shell or a home directory. Normally the user name has to
be postfix. You can simply add a new user with the useradd command. Then in the
passwd file in /etc directory make the default directory and shell to false values.
postfix:*:2001:2001:postfix:/no/where:/bin/false
Then create a user group that is not used by any user account. The name of the group will
be postdrop.
postdrop:*:2002
When you install postfix it will replace the existing sendmail service, mailq and
newaliases with its own version. Hence as a precaution you need to rename the sendmail
package s.
You have to rename the binary file with no extensions. For an example assume that it is
in the /usr/sbin directory. Then type the following command.
$ mv /usr/sbin/sendmail /usr/sbin/sendmail.orig
$ mv /usr/bin/mailq /usr/bin/mailq.orig
$ mv /usr/bin/newaliases /usr/bin/newaliases.orig
After renaming the files you have to execute the following command.
$ make install
When the installation proceeds the script will ask certain questions. The default values
are also shown along with the question. You can accept the default values by just
pressing the “ENTER” key. If you want to create an installable package you have to
change the install_root parameter.
2
Postfix Configuration
This setup has two separate domains namely ceylonlinux.com and ceygate.com. These
two domains have two users named suranga. (Two distinct users with the same name.)
To configure postfix with the above configuration use the following method.
First you have to mention the two domains in the virtual_alias_domains parameter.
Then you have to create separate user account for each e- mail address that is used within
the system.
The system accounts have not to be matched with the e- mail accounts you have created.
These accounts are mapped to the e- mail account in a separate file. In the main.cf file
make a pointer to that specific file.
virtual_alias_maps = hash: /etc/postfix/virtual_alias
virtual_alias is the name of the file that map the system accounts with the relevant e-
mail account.
vim /etc/postfix/virtual_alias
suranga@ceylonlinux.com suranga@localhost
suranga@ceygate.com suranga1@localhost
As it can be seen suranga is the system account that is used for the
suranga@ceylonlinux.com user and suranga1 is the system account that is used for the
suranga@ceygate.com user.
$ postmap virtual_alias
Then you have to edit the canonical maps parameter in the main.cf file.
canonical_maps = hash:/etc/postfix/canonical
3
Then create the /etc/postfix/canonical_maps file and insert the following information.
suranga suranga@ceylonlinux.com
suranga1 suranga@ceygate.com
postmap /etc/postfix/canonical
Then you have to specify to use maildir format in the main.cf file.
home_mailbox = Maildir/
Then you need to create Maildir directories in the home directory of each user.
mkdir /home/suranga/Maildir
mkdir /home/suranga1/Maildir
mkdir /home/suranga/Maildir/new
mkdir /home/suranga/Maildir/cur
mkdir /home/suranga/Maildir/tmp
postfix reload
Configuring Dovecot
4
Then you need to specify it to use /etc/passwd and /etc/shadow files for authentication
purposes.
auth default {
mechanisms = plain
passdb passwd {
args = /etc/passwd
}
passdb shadow {
args = /etc/shadow
}
userdb passwd {
args = /etc/passwd
args = mail = maildir:/home/%u/Maildir
}
}
Then if dovecot is already running find the process that is listening to port 110 (pop3)
lsof –i :110
/usr/local/sbin/dovecot
Then telnet to port 110 and check whether dovecot is working properly.
user suranga
pass ceylonlinux.
Note that ceylonlinux is user suranga’s password. If the setup is correct you will be able
to stay logged in.
5
# The general format of each line is: parameter = value. Lines
# that begin with whitespace continue the previous line. A value can
# contain references to other $names or ${name}s.
#
# NOTE - CHANGE NO MORE THAN 2-3 PARAMETERS AT A TIME, AND TEST
IF
# POSTFIX STILL WORKS AFTER EVERY CHANGE.
# SOFT BOUNCE
#
# The soft_bounce parameter provides a limited safety net for
# testing. When soft_bounce is enabled, mail will remain queued that
# would otherwise bounce. This parameter disables locally- generated
# bounces, and prevents the SMTP server from rejecting mail permanently
# (by changing 5xx replies into 4xx replies). However, soft_bounce
# is no cure for address rewriting mistakes or mail routing mistakes.
#
#soft_bounce = no
6
# particular, don't specify nobody or daemon. PLEASE USE A DEDICATED
# USER.
#
mail_owner = postfix
# SENDING MAIL
#
# The myorigin parameter specifies the domain that locally-posted
# mail appears to come from. The default is to append $myhostname,
# which is fine for small sites. If you run a domain with multiple
# machines, you should (1) change this to $mydomain and (2) set up
# a domain-wide alias database that aliases each user to
# user@that.users.mailhost.
#
# For the sake of consistency between sender and recipient addresses,
# myorigin also specifies the default domain name that is appended
# to recipient addresses that have no @domain part.
#
myorigin = $myhostname
myorigin = $mydomain
# RECEIVING MAIL
7
# The inet_interfaces parameter specifies the network interface
# addresses that this mail system receives mail on. By default,
# the software claims all active interfaces on the machine. The
# parameter also controls delivery of mail to user@[ip.address].
#
# See also the proxy_interfaces parameter, for network addresses that
# are forwarded to us via a proxy or network address translator.
#
# Note: you need to stop/start Postfix when this parameter changes.
#
#inet_interfaces = all
#mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
#mydestination = ceylonlinux.com,ceygate.com
#inet_interfaces = $myhostname
#inet_interfaces = $myhostname, localhost
#virtual_mailbox_domains = ceylonlinux.com,ceygate.com
virtual_mailbox_base = /usr/local/vmail
virtual_mailbox_maps = hash:/etc/postfix/virtual1
virtual_uid_maps = static:1003
virtual_gid_maps = static:1005
#virtual_alias_domains = ceylonlinux.com, ceygate.com
#virtual_alias_maps = hash:/etc/postfix/virtual_alias
8
# gateway, you should also include $mydomain.
#
# Do not specify the names of virtual domains - those domains are
# specified elsewhere (see VIRTUAL_README).
#
# Do not specify the names of domains that this machine is backup MX
# host for. Specify those names via the relay_domains settings for
# the SMTP server, or use permit_mx_backup if you are lazy (see
# STANDARD_CONFIGURATION_README).
#
# The local machine is always the final destination for mail addressed
# to user@[the.net.work.address] of an interface that the mail system
# receives mail on (see the inet_interfaces parameter).
#
# Specify a list of host or domain names, /file/name or type:table
# patterns, separated by commas and/or whitespace. A /file/name
# pattern is replaced by its contents; a type:table is matched when
# a name matches a lookup key (the right-hand side is ignored).
# Continue long lines by starting the next line with whitespace.
#
# See also below, section "REJECTING MAIL FOR UNKNOWN LOCAL USERS".
#
#mydestination = $myhostname, localhost.$mydomain, localhost
#mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
#mydestination = ceylonlinux.com,ceygate.com
#mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain,
# mail.$mydomain, www.$mydomain, ftp.$mydomain
9
# For example, you define $mydestination domain recipients in
# the $virtual_mailbox_maps files.
#
# - You redefine the local delivery agent in master.cf.
#
# - You redefine the "local_transport" setting in main.cf.
#
# - You use the "luser_relay", "mailbox_transport", or "fallback_transport"
# feature of the Postfix local delivery agent (see local(8)).
#
# Details are described in the LOCAL_RECIPIENT_README file.
#
# Beware: if the Postfix SMTP server runs chrooted, you probably have
# to access the passwd file via the proxymap service, in order to
# overcome chroot restrictions. The alternative, having a copy of
# the system passwd file in the chroot jail is just not practical.
#
# The right-hand side of the lookup tables is conveniently ignored.
# In the left- hand side, specify a bare username, an @domain.tld
# wild-card, or specify a user@domain.tld address.
#
#local_recipient_maps = unix:passwd.byname $alias_maps
#local_recipient_maps = proxy:unix:passwd.byname $alias_maps
#local_recipient_maps =
10
# or you can let Postfix do it for you (which is the default).
#
# By default (mynetworks_style = subnet), Postfix "trusts" SMTP
# clients in the same IP subnetworks as the local machine.
# On Linux, this does works correctly only with interfaces specified
# with the "ifconfig" command.
#
# Specify "mynetworks_style = class" when Postfix should "trust" SMTP
# clients in the same IP class A/B/C networks as the local machine.
# Don't do this with a dialup site - it would cause Postfix to "trust"
# your entire provider's network. Instead, specify an explicit
# mynetworks list by hand, as described below.
#
# Specify "mynetworks_style = host" when Postfix should "trust"
# only the local machine.
#
#mynetworks_style = class
#mynetworks_style = subnet
#mynetworks_style = host
11
# that Postfix is final destination for:
# - destinations that match $inet_interfaces or $proxy_interfaces,
# - destinations that match $mydestination
# - destinations that match $virtual_alias_domains,
# - destinations that match $virtual_mailbox_domains.
# These destinations do not need to be listed in $relay_domains.
#
# Specify a list of hosts or domains, /file/name patterns or type:name
# lookup tables, separated by commas and/or whitespace. Continue
# long lines by starting the next line with whitespace. A file name
# is replaced by its contents; a type:name table is matched when a
# (parent) domain appears as lookup key.
#
# NOTE: Postfix will not automatically forward mail for domains that
# list this system as their primary or backup MX host. See the
# permit_mx_backup restriction description in postconf(5).
#
#relay_domains = $mydestination
# INTERNET OR INTRANET
12
# mail for unknown relay users. This feature is off by default.
#
# The right-hand side of the lookup tables is conveniently ignored.
# In the left- hand side, specify an @domain.tld wild-card, or specify
# a user@domain.tld address.
#
#relay_recipient_maps = hash:/etc/postfix/relay_recipients
# ADDRESS REWRITING
#
# The ADDRESS_REWRITING_README document gives information about
# address masquerading or other forms of address rewriting including
# username->Firstname.Lastname mapping.
# TRANSPORT MAP
#
# See the discussion in the ADDRESS_REWRITING_README document.
# ALIAS DATABASE
#
13
# The alias_maps parameter specifies the list of alias databases used
# by the local delivery agent. The default list is system dependent.
#
# On systems with NIS, the default is to search the local alias
# database, then the NIS alias database. See aliases(5) for syntax
# details.
#
# If you change the alias database, run "postalias /etc/aliases" (or
# wherever your system stores the mail alias file), or simply run
# "newaliases" to build the necessary DBM or DB file.
#
# It will take a minute or so before changes become visible. Use
# "postfix reload" to eliminate the delay.
#
#alias_maps = dbm:/etc/aliases
#alias_maps = hash:/etc/aliases
#alias_maps = hash:/etc/aliases, nis:mail.aliases
#alias_maps = netinfo:/aliases
# DELIVERY TO MAILBOX
#
# The home_mailbox parameter specifies the optional pathname of a
# mailbox file relative to a user's home directory. The default
# mailbox file is /var/spool/mail/user or /var/mail/user. Specify
# "Maildir/" for qmail-style delivery (the / is required).
14
#
#home_mailbox = Mailbox
#home_mailbox = Maildir/
15
# non-UNIX accounts with "User unknown in local recipient table".
#
#mailbox_transport = lmtp:unix:/file/name
#mailbox_transport = cyrus
16
# JUNK MAIL CONTROLS
#
# The controls listed here are only a very small subset. The file
# SMTPD_ACCESS_README provides an overview.
17
# to the same user, because mailbox updates must happen sequentially,
# and expensive pipelines in .forward files can cause disasters when
# too many are run at the same time. With SMTP deliveries, 10
# simultaneous connections to the same domain could be sufficient to
# raise eyebrows.
#
# Each message delivery transport has its XXX_destination_concurrency_limit
# parameter. The default is $default_destination_concurrency_limit for
# most delivery transports. For the local delivery agent the default is 2.
#local_destination_concurrency_limit = 2
#default_destination_concurrency_limit = 20
# DEBUGGING CONTROL
#
# The debug_peer_level parameter specifies the increment in verbose
# logging level when an SMTP client or server host name or address
# matches a pattern in the debug_peer_list parameter.
#
debug_peer_level = 2
# If you can't use X, use this to capture the call stack when a
# daemon crashes. The result is in a file in the configuration
# directory, and is named after the process name and the process ID.
#
# debugger_command =
18
# PATH=/bin:/usr/bin:/usr/local/bin; export PATH; (echo cont;
# echo where) | gdb $daemon_directory/$process_name $process_id 2>&1
# >$config_directory/$process_name.$process_id.log & sleep 5
#
# Another possibility is to run gdb under a detached screen session.
# To attach to the screen sesssion, su root and run "screen -r
# <id_string>" where <id_string> uniquely matches one of the detached
# sessions (from "screen - list").
#
# debugger_command =
# PATH=/bin:/usr/bin:/sbin:/usr/sbin; export PATH; screen
# -dmS $process_name gdb $daemon_directory/$process_name
# $process_id & sleep 1
19
# sample_directory: The location of the Postfix sample configuration files.
# This parameter is obsolete as of Postfix 2.1.
#
sample_directory = /etc/postfix
# Default values are shown after each value, it's not required to uncomment
# any of the lines. Exception to this are paths, they're just examples
# with real defaults being based on configure options. The paths listed here
# are for configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var
# --with-ssldir=/etc/ssl
20
# these settings inside the protocol imap/pop3 { ... } section, so you can
# specify different ports for IMAP/POP3. For example:
# protocol imap {
# listen = *:10143
# ssl_listen = *:10943
# ..
# }
# protocol pop3 {
# listen = *:10100
# ..
# }
#listen = *
# Should all IMAP and POP3 processes be killed when Dovecot master process
# shuts down. Setting this to "no" means that Dovecot can be upgraded without
# forcing existing client connections to close (although that could also be
# a problem if the upgrade is eg. because of a security fix). This however
# means that after master process has died, the client processes can't write
# to log files anymore.
#shutdown_clients = yes
##
## Logging
##
# Use this logfile instead of syslog(). /dev/stderr can be used if you want to
# use stderr for logging (ONLY /dev/stderr - otherwise it is closed).
#log_path =
# Prefix for each line written to log file. % codes are in strftime(3)
# format.
#log_timestamp = "%b %d %H:%M:%S "
21
#syslog_facility = mail
##
## SSL settings
##
# PEM encoded X.509 SSL/TLS certificate and private key. They're opened before
# dropping root privileges, so keep the key file unreadable by anyone but
# root. Included doc/mkcert.sh can be used to easily generate self-signed
# certificate, just make sure to update the domains in dovecot-openssl.cnf
#ssl_cert_file = /etc/ssl/certs/dovecot.pem
#ssl_key_file = /etc/ssl/private/dovecot.pem
# How often to regenerate the SSL parameters file. Generation is quite CPU
# intensive operation. The value is in hours, 0 disables regeneration
# entirely.
#ssl_parameters_regenerate = 168
##
## Login processes
##
22
# Directory where authentication process places authentication UNIX sockets
# which login needs to be able to connect to. The sockets are created when
# running as root, so you don't have to worry about permissions. Note that
# everything in this directory is deleted when Dovecot is started.
#####################uncomented########################################
login_dir = /var/run/dovecot/login
# chroot login process to the login_dir. Only reason not to do this is if you
# wish to run the whole Dovecot without roots.
# http://wiki.dovecot.org/Rootless
#login_chroot = yes
# User to use for the login process. Create a completely new user for this,
# and don't use it anywhere else. The user must also belong to a group where
# only it has access, it's used to control access for authentication process.
# Note that this user is NOT used to access mails.
# http://wiki.dovecot.org/UserIds
#############################uncomented#################################
login_user = dovecot
# Should each login be processed in it's own process (yes), or should one
# login process be allowed to process multiple connections (no)? Yes is more
# secure, espcially with SSL/TLS enabled. No is faster since there's no need
# to create processes all the time.
#login_process_per_connection = yes
# Maximum number of extra login processes to create. The extra process count
# usually stays at login_processes_count, but when multiple users start logging
# in at the same time more extra processes are created. To prevent fork-bombing
# we check only once in a second if new processes should be created - if all
# of them are used at the time, we double their amount until limit set by this
# setting is reached. This setting is used only if
# login_process_per_connection is yes.
#login_max_processes_count = 128
23
# logging in actually login_processes_count * max_logging_users.
#login_max_logging_users = 256
##
## Mailbox locations and namespaces
##
# Default MAIL environment to use when it's not set. By leaving this empty
# dovecot tries to do some automatic detection as described in
# doc/mail- storages.txt. There are a few special variables you can use, eg.:
#
# %u - username
# %n - user part in user@domain, same as %u if there's no domain
# %d - domain part in user@domain, empty if there's no domain
# %h - home directory
#
# See doc/variables.txt for full list. Some examples:
#
# default_mail_env = maildir:/var/mail/%1u/%u/Maildir
# default_mail_env = mbox:~/mail/:INBOX=/var/mail/%u
# default_mail_env = mbox:/var/mail/%d/%n/:INDEX=/var/indexes/%d/%n
#
##################add maildir format for system accounts##########
default_mail_env = maildir:/home/%u/Maildir
24
#
# REMEMBER: If you add any namespaces, the default namespace must be added
# explicitly, ie. default_mail_env does nothing unless you have a namespace
# without a location setting. Default namespace is simply done by having a
# namespace with empty prefix.
#namespace private {
# Hierarchy separator to use. You should use the same separator for all
# namespaces or some clients get confused. '/' is usually a good one.
#separator = /
# There can be only one INBOX, and this setting defines which namespace
# has it.
#inbox = yes
# Grant access to these extra groups for mail processes. Typical use would be
# to give "mail" group write access to /var/mail to be able to create dotlocks.
#mail_extra_groups = dovecot
# Allow full filesystem access to clients. There's no access checks other than
# what the operating system does for the active UID/GID. It works with both
# maildir and mboxes, allowing you to prefix mailboxes names with eg. /path/
# or ~user/.
#mail_full_filesystem_access = no
##
## Mail processes
##
# Enable mail process debugging. This can help you figure out why Dovecot
# isn't finding your mails.
25
######################uncomented#####################################
mail_debug = no
# Log prefix for mail processes. See doc/variables.txt for list of possible
# variables you can use.
#####################uncomented####################################
mail_log_prefix = "%Us(%u): "
# Use mmap() instead of read() to read mail files. read() seems to be a bit
# faster with my Linux/x86 and it's better with NFS, so that's the default.
# Note that OpenBSD 3.3 and older don't work right with mail_read_mmaped = yes.
#mail_read_mmaped = no
# Don't use mmap() at all. This is required if you store indexes to shared
# filesystems (NFS or clustered filesystem).
#mmap_disable = no
# Don't write() to mmaped files. This is required for some operating systems
# which use separate caches for them, such as OpenBSD.
#mmap_no_write = no
# Locking method for index files. Alternatives are fcntl, flock and dotlock.
# Dotlocking uses some tricks which may create more disk I/O than other locking
# methods. NOTE: If you use NFS, remember to change also mmap_disable setting!
#lock_method = fcntl
# Drop all privileges before exec()ing the mail process. This is mostly
# meant for debugging, otherwise you don't get core dumps. It could be a small
# security risk if you use single UID for multiple users, as the users could
# ptrace() each others processes then.
#mail_drop_priv_before_exec = no
# Show more verbose process titles (in ps). Currently shows user name and
# IP address. Useful for seeing who are actually using the IMAP processes
# (eg. shared mailboxes or if same uid is used for multiple accounts).
#verbose_proctitle = no
# Valid UID range for users, defaults to 500 and above. This is mostly
# to make sure that users can't log in as daemons or other system users.
# Note that denying root logins is hardcoded to dovecot binary and can't
# be done even if first_valid_uid is set to 0.
#first_valid_uid = 500
#last_valid_uid = 0
26
# belongs to supplementary groups with non-valid GIDs, those groups are
# not set.
#first_valid_gid = 1
#last_valid_gid = 0
# Set max. process size in megabytes. Most of the memory goes to mmap()ing
# files, so it shouldn't harm much even if this limit is set pretty high.
#mail_process_size = 256
# Maximum allowed length for mail keyword name. It's only forced when trying
# to create new keywords.
#mail_max_keyword_length = 50
# ':' separated list of directories under which chrooting is allowed for mail
# processes (ie. /var/mail will allow chrooting to /var/mail/foo/bar too).
# This setting doesn't affect login_chroot or auth_chroot variables.
# WARNING: Never add directories here which local users can modify, that
# may lead to root exploit. Usually this should be done only if you don't
# allow shell access for users. See doc/configuration.txt for more information.
#valid_chroot_dirs =
# Default chroot directory for mail processes. This can be overridden for
# specific users in user database by giving /./ in user's home directory
# (eg. /home/./user chroots into /home). Note that usually there is no real
# need to do chrooting, Dovecot doesn't allow users to access files outside
# their mail directory anyway.
#mail_chroot =
##
## Mailbox handling optimizations
##
27
# different cached fields. Some do not benefit from them at all. Caching more
# than necessary generates useless disk I/O, so you don't want to do that
# either.
#
# Dovecot attempts to automatically figure out what client wants and it keeps
# only that. However the first few times a mailbox is opened, Dovecot hasn't
# yet figured out what client needs, so it may not perform optimally. If you
# know what fields the majority of your clients need, it may be useful to set
# these fields by hand. If client doesn't actually use them, Dovecot will
# eventually drop them.
#
# Usually you should just leave this field alone. The potential benefits are
# typically unnoticeable.
#mail_cache_fields =
# Space-separated list of fields that Dovecot should never save to cache file.
# Useful if you want to save disk space at the cost of more I/O when the fields
# needed.
#mail_never_cache_fields =
# The minimum number of mails in a mailbox before updates are done to cache
# file. This allows optimizing Dovecot's behavior to do less disk writes at
# the cost of more disk reads.
#mail_cache_min_mail_count = 0
# Save mails with CR+LF instead of plain LF. This makes sending those mails
# take less CPU, especially with sendfile() syscall with Linux and FreeBSD.
# But it also creates a bit more disk I/O which may just make it slower.
# Also note that if other software reads the mboxes/maildirs, they may handle
# the extra CRs wrong and cause problems.
#mail_save_crlf = no
##
## Maildir-specific settings
##
# By default LIST command returns all entries in maildir beginning with dot.
# Enabling this option makes Dovecot return only entries which are directories.
# This is done by stat()ing each entry, so it causes more disk I/O.
# (For systems setting struct dirent->d_type, this check is free and it's
28
# done always regardless of this setting)
#maildir_stat_dirs = no
# Copy mail to another folders using hard links. This is much faster than
# actually copying the file. This is problematic only if something modifies
# the mail in one folder but doesn't want it modified in the others. I don't
# know any MUA which would modify mail files directly. IMAP protocol also
# requires that the mails don't change, so it would be problematic in any case.
# If you care about performance, enable it.
################uncomented and set as yes##########################
maildir_copy_with_hardlinks = yes
##
## mbox-specific settings
##
# Which locking methods to use for locking mbox. There are four available:
# dotlock: Create <mailbox>.lock file. This is the oldest and most NFS-safe
# solution. If you want to use /var/mail/ like directory, the users
# will need write access to that directory.
# fcntl : Use this if possible. Works with NFS too if lockd is used.
# flock : May not exist in all systems. Doesn't work with NFS.
# lockf : May not exist in all systems. Doesn't work with NFS.
#
# You can use multiple locking methods; if you do the order they're declared
# in is important to avoid deadlocks if other MTAs/MUAs are using multiple
# locking methods as well. Some operating systems don't allow using some of
# them simultaneously.
#mbox_read_locks = fcntl
#mbox_write_locks = dotlock fcntl
# Maximum time in seconds to wait for lock (all of them) before aborting.
#mbox_lock_timeout = 300
# If dotlock exists but the mailbox isn't modified in any way, override the
# lock file after this many seconds.
#mbox_dotlock_change_timeout = 120
# When mbox changes unexpectedly we have to fully read it to find out what
# changed. If the mbox is large this can take a long time. Since the change
# is usually just a newly appended mail, it'd be faster to simply read the
# new mails. If this setting is enabled, Dovecot does this but still safely
# fallbacks to re-reading the whole mbox file whenever something in mbox isn't
# how it's expected to be. The only real downside to this setting is that if
# some other MUA changes message flags, Dovecot doesn't notice it immediately.
# Note that a full sync is done with SELECT, EXAMINE, EXPUNGE and CHECK
29
# commands.
#mbox_dirty_syncs = yes
# Like mbox_dirty_syncs, but don't do full syncs even with SELECT, EXAMINE,
# EXPUNGE or CHECK commands. If this is set, mbox_dirty_syncs is ignored.
#mbox_very_dirty_syncs = no
# Delay writing mbox headers until doing a full write sync (EXPUNGE and CHECK
# commands and when closing the mailbox). This is especially useful for POP3
# where clients often delete all mails. The downside is that our changes
# aren't immediately visible to other MUAs.
#mbox_lazy_writes = yes
# If mbox size is smaller than this (in kilobytes), don't write index files.
# If an index file already exists it's still read, just not updated.
#mbox_min_index_size = 0
##
## dbox-specific settings
##
# Maximum dbox file age in days until it's rotated. Day always begins from
# midnight, so 1 = today, 2 = yesterday, etc. 0 = check disabled.
#dbox_rotate_days = 0
##
## IMAP specific settings
##
protocol imap {
# Login executable location.
#login_executable = /usr/libexec/dovecot/imap-login
30
# This would attach gdb into the imap process and write backtraces into
# /tmp/gdbhelper.* files:
# mail_executable = /usr/libexec/dovecot/gdbhelper /usr/libexec/dovecot/imap
#
#mail_executable = /usr/libexe c/dovecot/imap
# Maximum IMAP command line length in bytes. 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 = 65536
31
}
##
## POP3 specific settings
##
protocol pop3 {
# Login executable location.
########################uncomented###################################
login_executable = /usr/local/libexec/dovecot/pop3- login
# Don't try to set mails non-recent or seen with POP3 sessions. This is
# mostly intended to reduce disk I/O. With maildir it doesn't move files
# from new/ to cur/, with mbox it doesn't write Status-header.
#pop3_no_flag_updates = no
# Support LAST command which exists in old POP3 specs, but has been removed
# from new ones. Some clients still wish to use this though. Enabling this
# makes RSET command clear all \Seen flags from messages.
#pop3_enable_last = no
32
# tpop3d : %Mf
#
# Note that Outlook 2003 seems to have problems with %v.%u format which was
# Dovecot's default, so if you're building a new server it would be a good
# idea to change this. %08Xu%08Xv should be pretty fail-safe.
#
# NOTE: Nowadays this is required to be set explicitly, since the old
# default was bad but it couldn't be changed without breaking existing
# installations. %08Xu%08Xv will be the new default, so use it for new
# installations.
#
pop3_uidl_format = %08Xv%08Xu
##
## LDA specific settings
##
protocol lda {
# Address to use when sending rejection mails.
33
postmaster_address = postmaster@example.com
##
## Authentication processes
##
# Executable location
##########################uncomented####################################
auth_executable = /usr/local/libexec/dovecot/dovecot-auth
# Space separated list of realms for SASL authentication mechanisms that need
# them. You can leave it empty if you don't want to support multiple realms.
# Many clients simply use the first one listed here, so keep the default realm
# first.
#auth_realms =
34
# Default realm/domain to use if none was specified. This is used for both
# SASL realms and appending @domain to username in plaintext logins.
#auth_default_realm =
# Username formatting before it's looked up from databases. You can use
# the standard variables here, eg. %Lu would lowercase the username, %n would
# drop away the domain if it was given, or "%n-AT-%d" would change the '@' into
# "-AT- ". This translation is done after auth_username_translation changes.
#auth_username_format =
# More verbose logging. Useful for figuring out why authentication isn't
# working.
#############################uncomented################################
auth_verbose = yes
# Even more verbose logging for debugging purposes. Shows for example SQL
# queries.
#auth_debug = no
# In case of password mismatches, log the passwords and used scheme so the
35
# problem can be debugged. Requires auth_debug=yes to be set.
###########################uncomentes and set to yes####################
auth_debug_passwords = yes
# Kerberos keytab to use for the GSSAPI mechanism. Will use the system
# default (usually /etc/krb5.keytab) if not specified.
#auth_krb5_keytab =
auth default {
# Space separated list of wanted authentication mechanisms:
# plain login digest- md5 cram- md5 ntlm rpa apop anonymous gssapi
mechanisms = plain
#
# Password database is used to verify user's password (and nothing more).
# You can have multiple passdbs and userdbs. This is useful if you want to
# allow both system users (/etc/passwd) and virtual users to login without
# duplicating the system users into virtual database.
#
# http://wiki.dovecot.org/Authentication
#
# By adding master=yes setting inside a passdb you make the passdb a list
# of "master users", who can log in as anyone else. Unless you're using PAM,
# you probably still want the destination user to be looked up from passdb
# that it really exists. This can be done by adding pass=yes setting to the
# master passdb.
#
# http://wiki.dovecot.org/MasterPassword
#passdb passwd-file {
# File contains a list of usernames, one per line
#args = /etc/dovecot.deny
#deny = yes
#}
36
# so it can't be used as userdb. If you don't want to use a separate user
# database (passwd usually), you can use static userdb.
# REMEMBER: You'll need /etc/pam.d/dovecot file created for PAM
# authentication to actually work.
passdb pam {
# [session=yes] [setcred=yes] [cache_key=<key>] [<service name>]
#
# session=yes makes Dovecot open and immediately close PAM session. Some
# PAM plugins need this to work, such as pam_mkhomedir.
#
# setcred=yes makes Dovecot establish PAM credentials if some PAM plugins
# need that. They aren't ever deleted though, so this isn't enabled by
# default.
#
# cache_key can be used to enable authentication caching for PAM
# (auth_cache_size also needs to be set). It isn't enabled by default
# because PAM modules can do all kinds of checks besides checking password,
# such as checking IP address. Dovecot can't know about these checks
# without some help. cache_key is simply a list of variables (see
# doc/variables.txt) which must match for the cached data to be used.
# Here are some examples:
# %u - Username must match. Probably sufficient for most uses.
# %u%r - Username and remote IP address must match.
# %u%s - Username and service (ie. IMAP, POP3) must match.
#
# If service name is "*", it means the authenticating service name
# is used, eg. pop3 or imap (/etc/pam.d/pop3, /etc/pam.d/imap).
#
# Some examples:
# args = session=yes *
# args = cache_key=%u dovecot
#args = dovecot
}
37
# /etc/shadow or similiar, using getspnam(). Deprecated by PAM nowadays.
passdb shadow {
args = /etc/shadow
}
# SQL database
#passdb sql {
# Path for SQL configuration file, see doc/dovecot-sql.conf for example
#args =
#}
# LDAP database
# passdb ldap {
# Path for LDAP configuration file, see doc/dovecot- ldap.conf for example
#args =
#}
#
# User database specifies where mails are located and what user/group IDs
# own them. For single-UID configuration use "static".
38
#
# http://wiki.dovecot.org/Authentication
# http://wiki.dovecot.org/VirtualUsers
#
# SQL database
#userdb sql {
# Path for SQL configuration file, see doc/dovecot-sql.conf for example
#args =
#}
# LDAP database
#userdb ldap {
# Path for LDAP configuration file, see doc/dovecot- ldap.conf for example
#args =
#}
# vpopmail
39
#userdb vpopmail {
#}
# "prefetch" user database means that the passdb already provided the
# needed information and there's no need to do a separate userdb lookup.
# This can be made to work with SQL and LDAP databases, see their example
# configuration files for more information how to do it.
# http://wiki.dovecot.org/AuthSpecials
#userdb prefetch {
#}
# User to use for the process. This user needs access to only user and
# password databases, nothing else. Only shadow and pam authentication
# requires roots, so use something else if possible. Note that passwd
# authentication with BSDs internally accesses shadow files, which also
# requires roots. Note that this user is NOT used to access mails.
# That user is specified by userdb above.
user = root
40
#group =
#}
#client {
# The client socket is generally safe to export to everyone. Typical use
# is to export it to your SMTP server so it can do SMTP AUTH lookups
# using it.
#path = /var/run/dovecot/auth-client
#mode = 0660
#}
#}
}
# If you wish to use another authentication server than dovecot-auth, you can
# use connect sockets. They assumed to be already running, Dovecot's master
# process only tries to connect to them. They don't need any other settings
# than the path for the master socket, as the configuration is done elsewhere.
# Note that the client sockets must exist in the login_dir.
#auth external {
# socket connect {
# master {
# path = /var/run/dovecot/auth- master
# }
# }
#}
##
## Dictionary server settings
##
dict {
#quota = mysql:/etc/dovecot-dict-quota.conf
}
##
## Plugin settings
##
plugin {
# Here you can give some extra environment variables to mail processes.
# This is mostly meant for passing parameters to plugins. %variable
41
# expansion is done for all values.
# ACL plugin. vfile backend reads ACLs from "dovecot-acl" file from maildir
# directory. You can also optionally give a global ACL directory path where
# ACLs are applied to all users' mailboxes. The global ACL directory contains
# one file for each mailbox, eg. INBOX or sub.mailbox.
#acl = vfile:/etc/dovecot-acls
# Trash plugin. When saving a message would make user go over quota, this
# plugin automatically deletes the oldest mails from configured mailboxes
# until the message can be saved within quota limits. The configuration file
# is a text file where each line is in format: <priority> <mailbox name>
# Mails are first deleted in lowest -> highest priority number order
#trash = /etc/dovecot-trash.conf
}
42