Skip to content

Commit d29ae32

Browse files
Merge pull request #32 from jeroenrnl/dovecot-config
Split dovecot config into multiple files
2 parents 55ec636 + 2a980c0 commit d29ae32

10 files changed

Lines changed: 120 additions & 467 deletions

File tree

etc/dovecot-conf-d/10-auth.conf

Lines changed: 2 additions & 117 deletions
Original file line numberDiff line numberDiff line change
@@ -2,127 +2,12 @@
22
## Authentication processes
33
##
44

5-
# Disable LOGIN command and all other plaintext authentications unless
6-
# SSL/TLS is used (LOGINDISABLED capability). Note that if the remote IP
7-
# matches the local IP (ie. you're connecting from the same computer), the
8-
# connection is considered secure and plaintext authentication is allowed.
9-
# See also ssl=required setting.
10-
#disable_plaintext_auth = yes
5+
disable_plaintext_auth = yes
116

12-
# Authentication cache size (e.g. 10M). 0 means it's disabled. Note that
13-
# bsdauth, PAM and vpopmail require cache_key to be set for caching to be used.
14-
#auth_cache_size = 0
15-
# Time to live for cached data. After TTL expires the cached record is no
16-
# longer used, *except* if the main database lookup returns internal failure.
17-
# We also try to handle password changes automatically: If user's previous
18-
# authentication was successful, but this one wasn't, the cache isn't used.
19-
# For now this works only with plaintext authentication.
20-
#auth_cache_ttl = 1 hour
21-
# TTL for negative hits (user not found, password mismatch).
22-
# 0 disables caching them completely.
23-
#auth_cache_negative_ttl = 1 hour
24-
25-
# Space separated list of realms for SASL authentication mechanisms that need
26-
# them. You can leave it empty if you don't want to support multiple realms.
27-
# Many clients simply use the first one listed here, so keep the default realm
28-
# first.
29-
#auth_realms =
30-
31-
# Default realm/domain to use if none was specified. This is used for both
32-
# SASL realms and appending @domain to username in plaintext logins.
33-
#auth_default_realm =
34-
35-
# List of allowed characters in username. If the user-given username contains
36-
# a character not listed in here, the login automatically fails. This is just
37-
# an extra check to make sure user can't exploit any potential quote escaping
38-
# vulnerabilities with SQL/LDAP databases. If you want to allow all characters,
39-
# set this value to empty.
40-
#auth_username_chars = abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890.-_@
41-
42-
# Username character translations before it's looked up from databases. The
43-
# value contains series of from -> to characters. For example "#@/@" means
44-
# that '#' and '/' characters are translated to '@'.
45-
#auth_username_translation =
46-
47-
# Username formatting before it's looked up from databases. You can use
48-
# the standard variables here, eg. %Lu would lowercase the username, %n would
49-
# drop away the domain if it was given, or "%n-AT-%d" would change the '@' into
50-
# "-AT-". This translation is done after auth_username_translation changes.
51-
#auth_username_format = %Lu
52-
53-
# If you want to allow master users to log in by specifying the master
54-
# username within the normal username string (ie. not using SASL mechanism's
55-
# support for it), you can specify the separator character here. The format
56-
# is then <username><separator><master username>. UW-IMAP uses "*" as the
57-
# separator, so that could be a good choice.
58-
#auth_master_user_separator =
59-
60-
# Username to use for users logging in with ANONYMOUS SASL mechanism
61-
#auth_anonymous_username = anonymous
62-
63-
# Maximum number of dovecot-auth worker processes. They're used to execute
64-
# blocking passdb and userdb queries (eg. MySQL and PAM). They're
65-
# automatically created and destroyed as needed.
66-
#auth_worker_max_count = 30
67-
68-
# Host name to use in GSSAPI principal names. The default is to use the
69-
# name returned by gethostname(). Use "$ALL" (with quotes) to allow all keytab
70-
# entries.
71-
#auth_gssapi_hostname =
72-
73-
# Kerberos keytab to use for the GSSAPI mechanism. Will use the system
74-
# default (usually /etc/krb5.keytab) if not specified. You may need to change
75-
# the auth service to run as root to be able to read this file.
76-
#auth_krb5_keytab =
77-
78-
# Do NTLM and GSS-SPNEGO authentication using Samba's winbind daemon and
79-
# ntlm_auth helper. <doc/wiki/Authentication/Mechanisms/Winbind.txt>
80-
#auth_use_winbind = no
81-
82-
# Path for Samba's ntlm_auth helper binary.
83-
#auth_winbind_helper_path = /usr/bin/ntlm_auth
84-
85-
# Time to delay before replying to failed authentications.
86-
#auth_failure_delay = 2 secs
87-
88-
# Require a valid SSL client certificate or the authentication fails.
89-
#auth_ssl_require_client_cert = no
90-
91-
# Take the username from client's SSL certificate, using
92-
# X509_NAME_get_text_by_NID() which returns the subject's DN's
93-
# CommonName.
94-
#auth_ssl_username_from_cert = no
95-
96-
# Space separated list of wanted authentication mechanisms:
97-
# plain login digest-md5 cram-md5 ntlm rpa apop anonymous gssapi otp skey
98-
# gss-spnego
99-
# NOTE: See also disable_plaintext_auth setting.
100-
auth_mechanisms = plain login digest-md5 cram-md5
7+
auth_mechanisms = plain login
1018

1029
##
10310
## Password and user databases
10411
##
10512

106-
#
107-
# Password database is used to verify user's password (and nothing more).
108-
# You can have multiple passdbs and userdbs. This is useful if you want to
109-
# allow both system users (/etc/passwd) and virtual users to login without
110-
# duplicating the system users into virtual database.
111-
#
112-
# <doc/wiki/PasswordDatabase.txt>
113-
#
114-
# User database specifies where mails are located and what user/group IDs
115-
# own them. For single-UID configuration use "static" userdb.
116-
#
117-
# <doc/wiki/UserDatabase.txt>
118-
119-
#!include auth-deny.conf.ext
120-
#!include auth-master.conf.ext
121-
122-
#!include auth-system.conf.ext
12313
!include auth-sql.conf.ext
124-
#!include auth-ldap.conf.ext
125-
#!include auth-passwdfile.conf.ext
126-
#!include auth-checkpassword.conf.ext
127-
#!include auth-vpopmail.conf.ext
128-
#!include auth-static.conf.ext
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
##
2+
## Director-specific settings.
3+
##
4+
5+
service director {
6+
}

etc/dovecot-conf-d/10-mail.conf

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
##
2+
## Mailbox locations and namespaces
3+
##
4+
5+
mail_home = /var/vmail/%d/%n
6+
mail_location = maildir:/var/vmail/%d/%n/:LAYOUT=fs
7+
8+
# If you need to set multiple mailbox locations or want to change default
9+
# namespace settings, you can do it by defining namespace sections.
10+
namespace inbox {
11+
inbox = yes
12+
13+
# See 15-mailboxes.conf for definitions of special mailboxes.
14+
}
15+
16+
mail_uid = vmail
17+
mail_gid = vmail
18+
19+
mail_privileged_group = vmail
20+
21+

etc/dovecot-conf-d/10-master.conf

Lines changed: 22 additions & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -1,132 +1,55 @@
1-
#default_process_limit = 100
2-
#default_client_limit = 1000
3-
4-
# Default VSZ (virtual memory size) limit for service processes. This is mainly
5-
# intended to catch and kill processes that leak memory before they eat up
6-
# everything.
7-
#default_vsz_limit = 256M
8-
9-
# Login user is internally used by login processes. This is the most untrusted
10-
# user in Dovecot system. It shouldn't have access to anything at all.
11-
#default_login_user = dovenull
12-
13-
# Internal user is used by unprivileged processes. It should be separate from
14-
# login user, so that login processes can't disturb other processes.
15-
#default_internal_user = dovecot
16-
171
service imap-login {
18-
inet_listener imap {
19-
#port = 143
20-
}
212
inet_listener imaps {
22-
#port = 993
23-
#ssl = yes
3+
port = 993
4+
ssl = yes
245
}
25-
26-
# Number of connections to handle before starting a new process. Typically
27-
# the only useful values are 0 (unlimited) or 1. 1 is more secure, but 0
28-
# is faster. <doc/wiki/LoginProcess.txt>
29-
#service_count = 1
30-
31-
# Number of processes to always keep waiting for more connections.
32-
#process_min_avail = 0
33-
34-
# If you set service_count=0, you probably need to grow this.
35-
#vsz_limit = $default_vsz_limit
366
}
377

388
service pop3-login {
399
inet_listener pop3 {
40-
#port = 110
10+
port = 110
4111
}
4212
inet_listener pop3s {
43-
#port = 995
44-
#ssl = yes
13+
port = 995
14+
ssl = yes
4515
}
4616
}
4717

4818
service submission-login {
4919
inet_listener submission {
50-
#port = 587
20+
port = 587
5121
}
5222
}
5323

5424
service lmtp {
55-
unix_listener lmtp {
56-
#mode = 0666
57-
}
25+
unix_listener /var/spool/postfix/private/dovecot-lmtp {
26+
mode = 0660
27+
group = postfix
28+
user = postfix
29+
}
5830

59-
# Create inet listener only if you can't use the above UNIX socket
60-
#inet_listener lmtp {
61-
# Avoid making LMTP visible for the entire internet
62-
#address =
63-
#port =
64-
#}
31+
user = vmail
6532
}
6633

67-
service imap {
68-
# Most of the memory goes to mmap()ing files. You may need to increase this
69-
# limit if you have huge mailboxes.
70-
#vsz_limit = $default_vsz_limit
71-
72-
# Max. number of IMAP processes (connections)
73-
#process_limit = 1024
34+
service managesieve-login {
35+
inet_listener sieve {
36+
port = 4190
37+
}
7438
}
7539

76-
service pop3 {
77-
# Max. number of POP3 processes (connections)
78-
#process_limit = 1024
79-
}
80-
81-
service submission {
82-
# Max. number of SMTP Submission processes (connections)
83-
#process_limit = 1024
84-
}
8540

8641
service auth {
87-
# auth_socket_path points to this userdb socket by default. It's typically
88-
# used by dovecot-lda, doveadm, possibly imap process, etc. Users that have
89-
# full permissions to this socket are able to get a list of all usernames and
90-
# get the results of everyone's userdb lookups.
91-
#
92-
# The default 0666 mode allows anyone to connect to the socket, but the
93-
# userdb lookups will succeed only if the userdb returns an "uid" field that
94-
# matches the caller process's UID. Also if caller's uid or gid matches the
95-
# socket's uid or gid the lookup succeeds. Anything else causes a failure.
96-
#
97-
# To give the caller full permissions to lookup all users, set the mode to
98-
# something else than 0666 and Dovecot lets the kernel enforce the
99-
# permissions (e.g. 0777 allows everyone full permissions).
10042
unix_listener auth-userdb {
101-
#mode = 0666
102-
#user =
103-
#group =
43+
mode = 0660
44+
user = vmail
45+
group = vmail
10446
}
10547

10648
# Postfix smtp-auth
10749
unix_listener /var/spool/postfix/private/auth {
108-
mode = 0666
109-
user = postfix
110-
group = postfix
50+
mode = 0660
51+
user = postfix
52+
group = postfix
11153
}
11254

113-
# Auth process is run as this user.
114-
#user = $default_internal_user
115-
}
116-
117-
service auth-worker {
118-
# Auth worker process is run as root by default, so that it can access
119-
# /etc/shadow. If this isn't necessary, the user should be changed to
120-
# $default_internal_user.
121-
#user = root
122-
}
123-
124-
service dict {
125-
# If dict proxy is used, mail processes should have access to its socket.
126-
# For example: mode=0660, group=vmail and global mail_access_groups=vmail
127-
unix_listener dict {
128-
#mode = 0600
129-
#user =
130-
#group =
131-
}
13255
}

etc/dovecot-conf-d/10-ssl.conf

Lines changed: 1 addition & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -2,74 +2,8 @@
22
## SSL settings
33
##
44

5-
# SSL/TLS support: yes, no, required. <doc/wiki/SSL.txt>
6-
ssl = yes
5+
ssl = required
76

8-
# PEM encoded X.509 SSL/TLS certificate and private key. They're opened before
9-
# dropping root privileges, so keep the key file unreadable by anyone but
10-
# root. Included doc/mkcert.sh can be used to easily generate self-signed
11-
# certificate, just make sure to update the domains in dovecot-openssl.cnf
127
ssl_cert = <__PF_TLS_CERTCHAIN_FILE__
138
ssl_key = <__PF_TLS_KEY_FILE__
149

15-
# If key file is password protected, give the password here. Alternatively
16-
# give it when starting dovecot with -p parameter. Since this file is often
17-
# world-readable, you may want to place this setting instead to a different
18-
# root owned 0600 file by using ssl_key_password = <path.
19-
#ssl_key_password =
20-
21-
# PEM encoded trusted certificate authority. Set this only if you intend to use
22-
# ssl_verify_client_cert=yes. The file should contain the CA certificate(s)
23-
# followed by the matching CRL(s). (e.g. ssl_ca = </etc/ssl/certs/ca.pem)
24-
#ssl_ca =
25-
26-
# Require that CRL check succeeds for client certificates.
27-
#ssl_require_crl = yes
28-
29-
# Directory and/or file for trusted SSL CA certificates. These are used only
30-
# when Dovecot needs to act as an SSL client (e.g. imapc backend or
31-
# submission service). The directory is usually /etc/ssl/certs in
32-
# Debian-based systems and the file is /etc/pki/tls/cert.pem in
33-
# RedHat-based systems.
34-
ssl_client_ca_dir = /etc/ssl/certs
35-
#ssl_client_ca_file =
36-
37-
# Request client to send a certificate. If you also want to require it, set
38-
# auth_ssl_require_client_cert=yes in auth section.
39-
#ssl_verify_client_cert = no
40-
41-
# Which field from certificate to use for username. commonName and
42-
# x500UniqueIdentifier are the usual choices. You'll also need to set
43-
# auth_ssl_username_from_cert=yes.
44-
#ssl_cert_username_field = commonName
45-
46-
# SSL DH parameters
47-
# Generate new params with `openssl dhparam -out /etc/dovecot/dh.pem 4096`
48-
# Or migrate from old ssl-parameters.dat file with the command dovecot
49-
# gives on startup when ssl_dh is unset.
50-
ssl_dh = </usr/share/dovecot/dh.pem
51-
52-
# Minimum SSL protocol version to use. Potentially recognized values are SSLv3,
53-
# TLSv1, TLSv1.1, and TLSv1.2, depending on the OpenSSL version used.
54-
#ssl_min_protocol = TLSv1
55-
56-
# SSL ciphers to use, the default is:
57-
#ssl_cipher_list = ALL:!kRSA:!SRP:!kDHd:!DSS:!aNULL:!eNULL:!EXPORT:!DES:!3DES:!MD5:!PSK:!RC4:!ADH:!LOW@STRENGTH
58-
# To disable non-EC DH, use:
59-
#ssl_cipher_list = ALL:!DH:!kRSA:!SRP:!kDHd:!DSS:!aNULL:!eNULL:!EXPORT:!DES:!3DES:!MD5:!PSK:!RC4:!ADH:!LOW@STRENGTH
60-
61-
# Colon separated list of elliptic curves to use. Empty value (the default)
62-
# means use the defaults from the SSL library. P-521:P-384:P-256 would be an
63-
# example of a valid value.
64-
#ssl_curve_list =
65-
66-
# Prefer the server's order of ciphers over client's.
67-
#ssl_prefer_server_ciphers = no
68-
69-
# SSL crypto device to use, for valid values run "openssl engine"
70-
#ssl_crypto_device =
71-
72-
# SSL extra options. Currently supported options are:
73-
# compression - Enable compression.
74-
# no_ticket - Disable SSL session tickets.
75-
#ssl_options =

0 commit comments

Comments
 (0)