[Dovecot] How to get a working dovecot.conf?

Kerem Erciyes kerem.erciyes at gmail.com
Sun Dec 26 16:09:47 EET 2010


This is quite wrong indeed.

You are attempting to use sqlite with MD5 at:

connect = /etc/dovecot/authdb.sqlite
default_pass_scheme = MD5

then you use mysql with scheme CRYPT:

driver = mysql
connect = host=localhost dbname=dbispconfig user=ispconfig
password=50b0152ba02189a94881c371ef1ef128
default_pass_scheme = CRYPT

---------------------

Do you really need SQL? If this is going to be a personal server with a few
accounts I think you should rather use a simpler scheme. I prefer plaintext
user and password databases over SQL for quick and small installs.

This is a Dovecot 1.2 + Postfix + Roundcube setup and works without any
problems. This is to give you a basic idea, please do not attempt to copy
paste this file, rather try to understand it. This setup was created after a
lot of reading, testing and reading (yep again!) and more testing, and
serves my purposes.


Here on this contains dovecot -n, postfix -n outputs, postfix
master.cffile, /etc/dovecot/passwd, /etc/postfix/virtual_mailbox_maps,
/etc/postfix/virtual_mailbox_domains and addmailuser.sh script that I based
on someone's script and changed a little for my purposes.

Anyone else wishes to comment on this setup is of course welcome to do so.
After writing all this I think this may warrant a HOW-TO page after all. :)

dovecot -n

# 1.2.9: /etc/dovecot/dovecot.conf
# OS: Linux 2.6.32.16-linode28 i686 Ubuntu 10.04.1 LTS ext3
log_timestamp: %Y-%m-%d %H:%M:%S
protocols: imap imaps pop3 pop3s
ssl_cert_file: /etc/ssl/keys/mail.server.crt
ssl_key_file: /etc/ssl/keys/mail.server.key
disable_plaintext_auth: no
login_dir: /var/run/dovecot/login
login_executable(default): /usr/lib/dovecot/imap-login
login_executable(imap): /usr/lib/dovecot/imap-login
login_executable(pop3): /usr/lib/dovecot/pop3-login
mail_privileged_group: mail
mail_location: maildir:/var/mail/%d/%n
mbox_write_locks: fcntl dotlock
mail_executable(default): /usr/lib/dovecot/imap
mail_executable(imap): /usr/lib/dovecot/imap
mail_executable(pop3): /usr/lib/dovecot/pop3
mail_plugin_dir(default): /usr/lib/dovecot/modules/imap
mail_plugin_dir(imap): /usr/lib/dovecot/modules/imap
mail_plugin_dir(pop3): /usr/lib/dovecot/modules/pop3
lda:
 postmaster_address: postmaster at mail.server
 mail_plugin_dir: /usr/lib/dovecot/modules/lda
 deliver_log_format: msgid=%m: %$
 log_path: /var/log/dovecot-deliver.log
 rejection_subject: Rejected: %s
 rejection_reason: Your message to <%t> was automatically rejected:%n%r
 auth_socket_path: /var/run/dovecot/auth-master
auth default:
 mechanisms: plain login
 passdb:
   driver: passwd-file
   args: /etc/dovecot/passwd
 userdb:
   driver: static
   args: uid=mail gid=mail home=/var/mail/%d/%n/
 socket:
   type: listen
   client:
     path: /var/spool/postfix/private/auth
     mode: 432
     user: postfix
     group: postfix
   master:
     path: /var/run/dovecot/auth-master
     mode: 438
 socket:
   type: listen
   client:
     path: /var/spool/postfix/private/dovecot-auth
     mode: 432
     user: postfix
     group: postfix

postconf -n

alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
append_dot_mydomain = no
biff = no
broken_sasl_auth_clients = yes
config_directory = /etc/postfix
inet_interfaces = all
mailbox_size_limit = 0
message_size_limit = 51200000
mydestination = mail.server, localhost.server, , localhost
myhostname = mail.server
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
myorigin = /etc/mailname
readme_directory = no
recipient_delimiter = +
relayhost =
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtp_use_tls = yes
smtpd_banner = $myhostname ESMTP $mail_name
smtpd_recipient_restrictions = reject_unknown_sender_domain,
reject_unknown_recipient_domain, reject_unauth_pipelining,
permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination,
reject_rbl_client list.dsbl.org, reject_rbl_client bl.spamcop.net,
reject_rbl_client sbl-xbl.spamhaus.org
smtpd_sasl_auth_enable = yes
smtpd_sasl_authenticated_header = yes
smtpd_sasl_local_domain = $myhostname
smtpd_sasl_path = private/dovecot-auth
smtpd_sasl_security_options = noanonymous
smtpd_sasl_type = dovecot
smtpd_sender_restrictions = reject_unknown_sender_domain
smtpd_tls_CAfile = /etc/ssl/keys/ca.crt
smtpd_tls_auth_only = yes
smtpd_tls_cert_file = /etc/ssl/keys/mail.server.crt
smtpd_tls_key_file = /etc/ssl/keys/mail.server.key
smtpd_tls_mandatory_ciphers = medium
smtpd_tls_mandatory_protocols = SSLv3, TLSv1
smtpd_tls_received_header = yes
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtpd_use_tls = yes
soft_bounce = yes
tls_random_source = dev:/dev/urandom
virtual_gid_maps = static:1001
virtual_mailbox_base = /home/mail
virtual_mailbox_domains = /etc/postfix/virtual_mailbox_domains
virtual_mailbox_maps = hash:/etc/postfix/virtual_mailbox_maps
virtual_minimum_uid = 1000
virtual_transport = dovecot
virtual_uid_maps = static:1001

/etc/postfix/master.cf - changes with this file activates smtps and
dovecot's deliver, also passes to dkim-filter for outgoing mail signing
(smtpd_milters=inet:localhost:8891) which should not be included unless you
have setup dkim-filter.

#
# Postfix master process configuration file.  For details on the format
# of the file, see the master(5) manual page (command: "man 5 master").
#
# Do not forget to execute "postfix reload" after editing this file.
#
# ==========================================================================
# service type  private unpriv  chroot  wakeup  maxproc command + args
#               (yes)   (yes)   (yes)   (never) (100)
# ==========================================================================
smtp      inet  n       -       -       -       -       smtpd
submission inet n       -       -       -       -       smtpd
  -o smtpd_tls_security_level=encrypt
  -o smtpd_sasl_auth_enable=yes
  -o smtpd_client_restrictions=permit_sasl_authenticated,reject
  -o milter_macro_daemon_name=ORIGINATING
  -o milter_default_action=accept
  -o smtpd_milters=inet:localhost:8891
smtps     inet  n       -       -       -       -       smtpd
  -o smtpd_tls_wrappermode=yes
  -o smtpd_sasl_auth_enable=yes
  -o smtpd_client_restrictions=permit_sasl_authenticated,reject
  -o milter_macro_daemon_name=ORIGINATING
  -o milter_default_action=accept
  -o smtpd_milters=inet:localhost:8891
#628       inet  n       -       -       -       -       qmqpd
pickup    fifo  n       -       -       60      1       pickup
cleanup   unix  n       -       -       -       0       cleanup
qmgr      fifo  n       -       n       300     1       qmgr
#qmgr     fifo  n       -       -       300     1       oqmgr
tlsmgr    unix  -       -       -       1000?   1       tlsmgr
rewrite   unix  -       -       -       -       -       trivial-rewrite
bounce    unix  -       -       -       -       0       bounce
defer     unix  -       -       -       -       0       bounce
trace     unix  -       -       -       -       0       bounce
verify    unix  -       -       -       -       1       verify
flush     unix  n       -       -       1000?   0       flush
proxymap  unix  -       -       n       -       -       proxymap
proxywrite unix -       -       n       -       1       proxymap
smtp      unix  -       -       -       -       -       smtp
# When relaying mail as backup MX, disable fallback_relay to avoid MX loops
relay     unix  -       -       -       -       -       smtp
    -o smtp_fallback_relay=
#       -o smtp_helo_timeout=5 -o smtp_connect_timeout=5
showq     unix  n       -       -       -       -       showq
error     unix  -       -       -       -       -       error
retry     unix  -       -       -       -       -       error
discard   unix  -       -       -       -       -       discard
local     unix  -       n       n       -       -       local
virtual   unix  -       n       n       -       -       virtual
lmtp      unix  -       -       -       -       -       lmtp
anvil     unix  -       -       -       -       1       anvil
scache    unix  -       -       -       -       1       scache
#
# ====================================================================
# Interfaces to non-Postfix software. Be sure to examine the manual
# pages of the non-Postfix software to find out what options it wants.
#
# Many of the following services use the Postfix pipe(8) delivery
# agent.  See the pipe(8) man page for information about ${recipient}
# and other message envelope options.
# ====================================================================
#
dovecot   unix  -       n       n       -       -       pipe
  flags=DRhu user=mail:mail argv=/usr/lib/dovecot/deliver -d ${recipient}

/etc/dovecot/passwd

root at server.com:{PLAIN}mypassword
user at server.com:{PLAIN}mypassword
info at server.org:{PLAIN}mypassword

/etc/postfix/virtual_mailbox_domains - which domains are allowed to relay
mail

server.com
server.org
server.net

/etc/postfix/virtual_mailbox_maps - where are mailboxes with regard to the
mail home

root at server.com       server.com/root/
user at server.com       server.com/user/
info at server.org       server.org/info/

addmailuser.sh - add the mail user to /etc/dovecot/passwd and
/etc/postfix/virtual_mailbox_maps, rehash the virtual_mailbox_maps file so
the user can be found via postfix

#!/bin/bash

echo "$1" > /tmp/user
user=`cat /tmp/user | cut -f1 -d "@"`
domain=`cat /tmp/user | cut -f2 -d "@"`
echo "$user@$domain:{PLAIN}$2" >> /etc/dovecot/passwd

# add user to postfix virtual map file and reload Postfix
echo $1        $domain/$user/ >> /etc/postfix/virtual_mailbox_maps
postmap /etc/postfix/virtual_mailbox_maps

echo "$1 added to user database, reload postfix & dovecot to activate this
user"






On Fri, Dec 24, 2010 at 9:32 PM, Oddball <monkey9 at iae.nl> wrote:
> Hi,
>
> As a matter of fact no..
> I am sort of new to commandline, and i find it extremely difficult to
> find my way between all howto's.. to know which command to use where,
> and when.... but i am learning
> I have taken a look at dovecot-sql.conf, and saw a few possibilities, or
> options:
> the path to the databasefile, from which i think it should be:
>
> connect = /etc/dovecot/authdb.sqlite
>
> default_pass_scheme = MD5
>
> but then, i am lost. it atm looks like abracadabra to me..
>
> at the end of the file is the config of ISPConfig:
>
> driver = mysql
> connect = host=localhost dbname=dbispconfig user=ispconfig
> password=50b0152ba02189a94881c371ef1ef128
> default_pass_scheme = CRYPT
>
> password_querry = SELECT password FROM mail_user WHERE email = '%u' AND
> disable%Ls = 'n'
> user_querry = SELECT email as user, maildir as home, CONCAT('maildir:',
> maildir,'/Maildir') as mail, uid, gid, CONCAT('maildir:storage=',
> floor(quota/1024))AS quota, CONCAT(maildir, '/.sieve') as sieve FROM
> mail_user WHERE email = '%u' AND disable%Ls = 'n'
>
> at this moment i would not know what i should write here when i want to
> login from squirrelmail...
> AND most important: how to create a user and password at the right
place...
>
> thnx for your attention...
>
> Rob.
>
>
> Op 24-12-10 18:25, Kerem Erciyes schreef:
>> Hi,
>>
>> Have you populated the dovecot-sql.conf and the SQL database tahat is
>> referenced by it?
>>
>> -KE
>>
>> On Fri, Dec 24, 2010 at 6:24 PM, oddball56 <monkey9 at iae.nl> wrote:
>>
>>> Hi again,
>>>
>>> It seems i have undone some errors, as the output now shows the version
of
>>> dovecot and the os:
>>>
>>> # 2.0.8: /etc/dovecot/dovecot.conf
>>> # OS: Linux 2.6.34.7-0.5-default i686 openSUSE 11.3 (i586) reiserfs
>>> auth_mechanisms = plain login
>>> disable_plaintext_auth = no
>>> first_valid_gid = 1000
>>> first_valid_uid = 1000
>>> last_valid_gid = 5000
>>> last_valid_uid = 5000
>>> log_timestamp = "%Y-%m-%d %H:%M:%S "
>>> mail_location = maildir:/var/vmail/%d/%n/Maildir
>>> managesieve_notify_capability = mailto
>>> managesieve_sieve_capability = fileinto reject envelope
encoded-character
>>> vacation subaddress comperator-i;ascii-numeric relational regex
imap4flags
>>> copy include variables body enotify environment mailbox date
>>> passdb {
>>>  driver = pam
>>> }
>>> passdb {
>>>  args = /etc/dovecot-sql.conf
>>>  driver = sql
>>> }
>>> plugin {
>>>  quota = maildir
>>>  sieve = ~/.dovecot.sieve
>>>  sieve_dir = ~/sieve
>>> }
>>> protocols = imap pop3
>>> ssl = no
>>> userdb {
>>>  driver = passwd
>>> }
>>> userdb {
>>>  args = /etc/dovecot-sql.conf
>>>  driver = sql
>>> }
>>> protocol imap {
>>>  mail_plugin_dir = /usr/lib/dovecot/imap
>>>  mail_plugins = quota imap_quota
>>>  service imap {
>>>    executable = /usr/lib/dovecot/rawlog /usr/lib/dovecot/imap
>>>  }
>>> }
>>> protocol pop3 {
>>>  mail_plugin_dir = /usr/lib/dovecot/modules/pop3
>>>  mail_plugins = quota
>>>  pop3_uidl_format = %08Xu%08Xv
>>>  service pop3 {
>>>    executable = /usr/lib/dovecot/rawlog /usr/lib/dovecot/pop3
>>>  }
>>> }
>>> protocol sieve {
>>>  service sieve {
>>>    executable = /usr/lib/dovecot/managesieve
>>>  }
>>> }
>>> protocol lda {
>>>  auth_socket_path = /var/run/dovecot/auth-master
>>>  hostname = AsusTT-sfn6
>>>  mail_plugins = sieve quota
>>>  postmaster_adress = postmaster at asustt-sfn6.site
>>> }
>>>
>>>
>>> I have not been able to login, but going to start over creating a userdb
to
>>> test.
>>> Thanx for the help, it feels great to know there are people out there
who
>>> care, and want to help others..
>>>
>>> Rob.
>>>
>>>
>>>
>>> --
>>> View this message in context:
http://old.nabble.com/How-to-get-a-working-dovecot.conf--tp30506797p30528849.html
>>> Sent from the Dovecot mailing list archive at Nabble.com.
>>>
>>>
>>>
>>
>>
>>
>
>
> --
>
> Enjoy your time around,
>
>
> Oddball    (M9.)     (Now or never...)
>
>
>  OS:  Linux 2.6.34-12-desktop x86_64
>  Huidige gebruiker:  oddball at AMD64x2sfn1
>  Systeem:  openSUSE 11.3 (x86_64)
>  KDE:  4.4.4 (KDE 4.4.4) "release 2"
>
>



-- 
Kerem Erciyes
Sistem Danismani
http://proje.keremerciyes.com

kerem.erciyes at gmail.com
+90 532 737 05 83


More information about the dovecot mailing list