I have been running Dovecot for sometime, but I have just used someone else efforts on customizing it. Many of these throw out the dovecot/conf.d files for a single dovecot.conf with no explanation on what does what. So tell you a few conf.d files to edit. So over the past few days, I have rolled up my sleeves and did my best to work out how to modify the proper conf.d files. To 'stay true' to the Dovecot maintainer's config organization. The target is Centos7 with Dovecot 2.2.10-7 It was HARD! Besides dovecot.conf, I had to modify 13 conf.d files. Add 3 .ext files in /etc/dovecot, and set up sieve. I will soon have my total instructions available on my server, but to share with you what I have done for Dovecot customization and maybe to get some recommendations on improvements. For the most part, I have used SED to modify the conf files. I use a few env variables: your_domain_tld= your_host_only= your_host_tld=$your_host_only.$your_domain_tld Postfix_Database_Password= What follows are the pieces of my customization, all comments welcomed (this is NOT adequately tested! That is later in the week!): sed -i -e "/^#protocols/s/$/ sieve/w /dev/stdout" /etc/dovecot/dovecot.conf sed -i -e "s/^#protocols/protocols/w /dev/stdout" /etc/dovecot/dovecot.conf sed -i -e "s/#quota = /sqlquota = /w /dev/stdout" /etc/dovecot/dovecot.conf sed -i -e "/^auth_mechanisms/s/$/ login/w /dev/stdout" /etc/dovecot/conf.d/10-auth.conf sed -i -e 's/^#!include auth-sql.conf.ext/!include auth-sql.conf.ext/w /dev/stdout' /etc/dovecot/conf.d/10-auth.conf sed -i -e "0,/#userdb {/ s/#userdb {/userdb {/w /dev/stdout" /etc/dovecot/conf.d/auth-sql.conf.ext sed -i -e "s/# driver = prefetch/ driver = prefetch\n }/w /dev/stdout" /etc/dovecot/conf.d/auth-sql.conf.ext sed -i -e "/^#mail_location/s/$/maildir:\/home\/vmail\/%d\/%n/w /dev/stdout" /etc/dovecot/conf.d/10-mail.conf sed -i -e "s/^#mail_location/mail_location/w /dev/stdout" /etc/dovecot/conf.d/10-mail.conf sed -i -e "s/first_valid_uid = 1000/first_valid_uid = 101/w /dev/stdout" /etc/dovecot/conf.d/10-mail.conf sed -i -e "s/#first_valid_gid = 1/first_valid_gid = 12/w /dev/stdout" /etc/dovecot/conf.d/10-mail.conf sed -i "/unix_listener auth-userdb/ a mode = 0666\n user = vmail\n group = mail" /etc/dovecot/conf.d/10-master.conf sed -i "/#unix_listener \/var\/spool/ a mode = 0666\n user = postfix\n group = postfix\n }" /etc/dovecot/conf.d/10-master.conf sed -i -e "s/#unix_listener \/var\/spool/unix_listener \/var\/spool/w /dev/stdout" /etc/dovecot/conf.d/10-master.conf sed -i "/unix_listener dict/ a mode = 0666\n user = vmail\n group = mail" /etc/dovecot/conf.d/10-master.conf sed -i -e "s/^mode/ mode/w /dev/stdout" /etc/dovecot/conf.d/10-master.conf sed -i -e "s/dovecot\/certs\/dovecot.pem/tls\/certs\/$your_host_tld.crt/w /dev/stdout" /etc/dovecot/conf.d/10-ssl.conf sed -i -e "s/dovecot\/private\/dovecot.pem/tls\/private\/$your_host_tld.key/w /dev/stdout" /etc/dovecot/conf.d/10-ssl.conf sed -i -e "/^#postmaster_address/s/$/ postmaster@$your_domain_tld/w /dev/stdout" /etc/dovecot/conf.d/15-lda.conf sed -i -e "s/^#postmaster_address/postmaster_address/w /dev/stdout" /etc/dovecot/conf.d/15-lda.conf sed -i "/#mail_plugins/ a mail_plugins = quota sieve" /etc/dovecot/conf.d/15-lda.conf sed -i -e "s/^mail_plugins/ mail_plugins/w /dev/stdout" /etc/dovecot/conf.d/15-lda.conf sed -i -e "s/^#lda_mailbox_autocreate = no/lda_mailbox_autocreate = yes/w /dev/stdout" /etc/dovecot/conf.d/15-lda.conf sed -i -e "s/^#lda_mailbox_autosubscribe = no/lda_mailbox_autosubscribe = yes/w /dev/stdout" /etc/dovecot/conf.d/15-lda.conf sed -i "/#mail_plugins / a mail_plugins = quota imap_quota trash" /etc/dovecot/conf.d/20-imap.conf sed -i -e "s/^mail_plugins/ mail_plugins/w /dev/stdout" /etc/dovecot/conf.d/20-imap.conf sed -i "/#imap_client_workarounds/ a imap_client_workarounds = delay-newmail" /etc/dovecot/conf.d/20-imap.conf sed -i "/#mail_plugins/ a mail_plugins = sieve" /etc/dovecot/conf.d/20-lmtp.conf sed -i -e "s/^mail_plugins/ mail_plugins/w /dev/stdout" /etc/dovecot/conf.d/20-lmtp.conf sed -i -e "s/^#lmtp_save_to_detail_mailbox = no/lmtp_save_to_detail_mailbox = yes/w /dev/stdout" /etc/dovecot/conf.d/20-lmtp.conf sed -i -e "s/#service managesieve-login/service managesieve-login/w /dev/stdout" /etc/dovecot/conf.d/20-managesieve.conf sed -i -e "s/#inet_listener sieve {/inet_listener sieve {/w /dev/stdout" /etc/dovecot/conf.d/20-managesieve.conf sed -i -e "s/# port = 4190/ port = 4190\n }/w /dev/stdout" /etc/dovecot/conf.d/20-managesieve.conf sed -i "/#vsz_limit/ a }" /etc/dovecot/conf.d/20-managesieve.conf sed -i "/#mail_plugins/ a mail_plugins = quota" /etc/dovecot/conf.d/20-pop3.conf sed -i -e "s/^mail_plugins/ mail_plugins/w /dev/stdout" /etc/dovecot/conf.d/20-pop3.conf sed -i "/#pop3_client_workarounds/ a pop3_client_workarounds = outlook-no-nuls oe-ns-eoh" /etc/dovecot/conf.d/20-pop3.conf sed -i -e "s/#acl = /acl = /w /dev/stdout" /etc/dovecot/conf.d/90-acl.conf sed -i -e "s/#sieve_before =/sieve_before = \/home\/sieve\/globalfilter.sieve/w /dev/stdout" /etc/dovecot/conf.d/90-sieve.conf cat <<EOF>>/etc/dovecot/conf.d/90-quota.conf || exit 1 plugin { quota = dict:user::proxy::sqlquota trash = /etc/dovecot/dovecot-trash.conf.ext } EOF cat <<EOF>/etc/dovecot/dovecot-trash.conf.ext || exit 1 # Spam mailbox is emptied before Trash 1 Spam # Trash mailbox is emptied before Sent # 2 Trash # If both Sent and "Sent Messages" mailboxes exist, the next oldest message # to be deleted is looked up from both of the mailboxes. # 3 Sent # 3 Sent Messages EOF cat <<EOF>/etc/dovecot/dovecot-sql.conf.ext || exit 1 driver = mysql connect = host=localhost dbname=postfix user=postfix password=$Postfix_Database_Password default_pass_scheme = MD5-CRYPT # following should all be on one line. password_query = SELECT username as user, password, concat('/home/vmail/', maildir) as userdb_home, concat('maildir:/home/vmail/', maildir) as userdb_mail, 101 as userdb_uid, 12 as userdb_gid FROM mailbox WHERE username = '%u' AND active = '1' # following should all be on one line user_query = SELECT concat('/home/vmail/', maildir) as home, concat('maildir:/home/vmail/', maildir) as mail, 101 AS uid, 12 AS gid, CONCAT('*:messages=30000:bytes=', quota) as quota_rule FROM mailbox WHERE username = '%u' AND active = '1' EOF cat <<EOF>/etc/dovecot/dovecot-dict-sql.conf.ext || exit 1 connect = host=localhost dbname=postfix user=postfix password=$Postfix_Database_Password map { pattern = priv/quota/storage table = quota2 username_field = username value_field = bytes } map { pattern = priv/quota/messages table = quota2 username_field = username value_field = messages } EOF mkdir /home/sieve cat <<EOF>/home/sieve/globalfilter.sieve || exit 1 require "fileinto"; if header :contains "X-Spam-Flag" "YES" { fileinto "Spam"; } if header :contains "subject" "***SPAM***" { fileinto "Spam"; } EOF sievec /home/sieve/globalfilter.sieve chown -R vmail:mail /home/sieve
Robert,
What would be the benefit of using sed against making customized files and just copying them ? I'd probably just want to copy a working version of /etc/dovecot/ conf files instead of modifying my existing files with sed scripts (or create new ones with cat).
-- Yassine.
On 03/22/2017 11:36 AM, chaouche yacine wrote:
Robert,
What would be the benefit of using sed against making customized files and just copying them ? I'd probably just want to copy a working version of /etc/dovecot/ conf files instead of modifying my existing files with sed scripts (or create new ones with cat).
new options are left unaltered. I learned this with postfix, to use postconf instead of trying to replace main.cf.
I thought about mv old confs then cat new confs, but again, there are other things set up, and I worked at changing what needed customization, rather than wholesale replacement.
On Mar 22, 2017, at 18:25, Robert Moskowitz rgm@htt-consult.com wrote:
On 03/22/2017 11:36 AM, chaouche yacine wrote: Robert,
What would be the benefit of using sed against making customized files and just copying them ? I'd probably just want to copy a working version of /etc/dovecot/ conf files instead of modifying my existing files with sed scripts (or create new ones with cat).
new options are left unaltered. I learned this with postfix, to use postconf instead of trying to replace main.cf.
I thought about mv old confs then cat new confs, but again, there are other things set up, and I worked at changing what needed customization, rather than wholesale replacement.
Did you consider putting your customization in a local.conf which should be tried at the end? Could put whatever explanation in there you want. On a system like Debian this would more easily allow the default files to be upgraded without intervention.
-- Rob
On 03/22/2017 09:16 PM, Rob McAninch wrote:
On Mar 22, 2017, at 18:25, Robert Moskowitz rgm@htt-consult.com wrote:
On 03/22/2017 11:36 AM, chaouche yacine wrote: Robert,
What would be the benefit of using sed against making customized files and just copying them ? I'd probably just want to copy a working version of /etc/dovecot/ conf files instead of modifying my existing files with sed scripts (or create new ones with cat). new options are left unaltered. I learned this with postfix, to use postconf instead of trying to replace main.cf.
I thought about mv old confs then cat new confs, but again, there are other things set up, and I worked at changing what needed customization, rather than wholesale replacement. Did you consider putting your customization in a local.conf which should be tried at the end? Could put whatever explanation in there you want. On a system like Debian this would more easily allow the default files to be upgraded without intervention.
I have not seen any reference to a local.conf. Can you point this out to me? I will have to see that it is maintained in Centos. But some of the mods are additions (like plugins) to existing lines. I would have to find out how those are processed.
thanks
-- Rob McAninch robmcaninch.com (Sent from my iPhone)
On Mar 22, 2017, at 23:53, Robert Moskowitz rgm@htt-consult.com wrote:
On 03/22/2017 09:16 PM, Rob McAninch wrote:
On Mar 22, 2017, at 18:25, Robert Moskowitz rgm@htt-consult.com wrote:
On 03/22/2017 11:36 AM, chaouche yacine wrote: Robert,
What would be the benefit of using sed against making customized files and just copying them ? I'd probably just want to copy a working version of /etc/dovecot/ conf files instead of modifying my existing files with sed scripts (or create new ones with cat). new options are left unaltered. I learned this with postfix, to use postconf instead of trying to replace main.cf.
I thought about mv old confs then cat new confs, but again, there are other things set up, and I worked at changing what needed customization, rather than wholesale replacement. Did you consider putting your customization in a local.conf which should be tried at the end? Could put whatever explanation in there you want. On a system like Debian this would more easily allow the default files to be upgraded without intervention.
I have not seen any reference to a local.conf. Can you point this out to me? I will have to see that it is maintained in Centos. But some of the mods are additions (like plugins) to existing lines. I would have to find out how those are processed.
It is mentioned here http://wiki.dovecot.org/ConfigFile
Debian Jessie has the last line of dovecot.conf as:
!include_try local.conf
-- Rob
On 03/23/2017 12:15 AM, Rob McAninch wrote:
-- Rob McAninch robmcaninch.com (Sent from my iPhone)
On Mar 22, 2017, at 23:53, Robert Moskowitzrgm@htt-consult.com wrote:
On 03/22/2017 09:16 PM, Rob McAninch wrote:
On Mar 22, 2017, at 18:25, Robert Moskowitzrgm@htt-consult.com wrote:
On 03/22/2017 11:36 AM, chaouche yacine wrote: Robert,
What would be the benefit of using sed against making customized files and just copying them ? I'd probably just want to copy a working version of/etc/dovecot/ conf files instead of modifying my existing files with sed scripts (or create new ones with cat). new options are left unaltered. I learned this with postfix, to use postconf instead of trying to replace main.cf.
I thought about mv old confs then cat new confs, but again, there are other things set up, and I worked at changing what needed customization, rather than wholesale replacement. Did you consider putting your customization in a local.conf which should be tried at the end? Could put whatever explanation in there you want. On a system like Debian this would more easily allow the default files to be upgraded without intervention.
I have not seen any reference to a local.conf. Can you point this out to me? I will have to see that it is maintained in Centos. But some of the mods are additions (like plugins) to existing lines. I would have to find out how those are processed. It is mentioned here http://wiki.dovecot.org/ConfigFile
Debian Jessie has the last line of dovecot.conf as:
!include_try local.conf
Did a tail and see the same line in Centos.
I will have to think about the best way to use this and if it CAN be used for all the customization.
I have some ideas. Starting with a comment of which conf.d file a particular section is customizing.
thanks
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On Thu, 23 Mar 2017, Robert Moskowitz wrote:
On 03/23/2017 12:15 AM, Rob McAninch wrote:
On Mar 22, 2017, at 23:53, Robert Moskowitzrgm@htt-consult.com wrote:
It is mentioned here http://wiki.dovecot.org/ConfigFile
Debian Jessie has the last line of dovecot.conf as:
!include_try local.conf
Did a tail and see the same line in Centos.
I will have to think about the best way to use this and if it CAN be used for all the customization.
I have some ideas. Starting with a comment of which conf.d file a particular section is customizing.
This seems to be the end of the example dovecot.conf:
# Most of the actual configuration gets included below. The filenames are # first sorted by their ASCII value and parsed in that order. The 00-prefixes # in filenames are intended to make it easier to understand the ordering. !include conf.d/*.conf
# A config file can also tried to be included without giving an error if # it's not found: !include_try local.conf
========
I put my changes into new files sometimes with the same 00-prefix stem. There are settings that e.g. to change defaults, which are not picked up by other sections if mentioned in the last include file.
Steffen Kaiser -----BEGIN PGP SIGNATURE----- Version: GnuPG v1
iQEVAwUBWNN39Hz1H7kL/d9rAQJRiQgAnL/NcZXOCjNEvY+AgUwQrPbAJz98kR/a 1hGb1FlI4Ssd/ApTIUIHLKRuKAlXt+s7EMMg5zbuKzQWNvXpJodRkkHH5WZcHJkX cMcT7XxKe7ndt8yBbZ9fAFo5XupcvIyLUfCUb50Izr5HsC6ElXuQ6ntRthO+jbtg AOkxH02loxhXJdMsJkuLkikIZ8vRAwK1Mo0hmyT2VqfMPJt7qx2GcU1b6Fx90jEj s3PusBI50ONbp5Sa7z7x1VlJYNxc6hf66lqoWvoY7xayEpCXk+QM+PaR2E/Du2TY x8JTR09KRNo8ouzZoWjwOuLCdDCrDefeQ5sqhAzN11rEZ4aPmMh6mw== =sHJC -----END PGP SIGNATURE-----
On 03/22/2017 11:15 PM, Rob McAninch wrote:
-- Rob McAninch robmcaninch.com (Sent from my iPhone)
On Mar 22, 2017, at 23:53, Robert Moskowitzrgm@htt-consult.com wrote:
On 03/22/2017 09:16 PM, Rob McAninch wrote:
On Mar 22, 2017, at 18:25, Robert Moskowitzrgm@htt-consult.com wrote:
On 03/22/2017 11:36 AM, chaouche yacine wrote: Robert,
What would be the benefit of using sed against making customized files and just copying them ? I'd probably just want to copy a working version of/etc/dovecot/ conf files instead of modifying my existing files with sed scripts (or create new ones with cat). new options are left unaltered. I learned this with postfix, to use postconf instead of trying to replace main.cf.
I thought about mv old confs then cat new confs, but again, there are other things set up, and I worked at changing what needed customization, rather than wholesale replacement. Did you consider putting your customization in a local.conf which should be tried at the end? Could put whatever explanation in there you want. On a system like Debian this would more easily allow the default files to be upgraded without intervention.
I have not seen any reference to a local.conf. Can you point this out to me? I will have to see that it is maintained in Centos. But some of the mods are additions (like plugins) to existing lines. I would have to find out how those are processed. It is mentioned here http://wiki.dovecot.org/ConfigFile
Debian Jessie has the last line of dovecot.conf as:
!include_try local.conf
Finally revamped my approach to a local.conf file. I maintained an organization based on which conf file is 'modified' to assist review against later versions of Dovecot. I had observed in developing this, using a guide written for Centos6 (and no telling really how old), that some things had changed.
Of course, I still have to test this out. I have quotas actually handled in postfix and dovecot. I can think of reasons why you do both. And if you see anything here obviously wrong, I appreciate any review. Will save me headaches later. Thanks for the help so far.
Here is what I got:
cat <<EOF>/etc/dovecot/local.conf || exit 1 # Developed on Dovecot 2.2.10
# dovecot.conf protocols = imap pop3 lmtp sieve dict { sqlquota = mysql:/etc/dovecot/dovecot-dict-sql.conf.ext }
# 10-auth.conf !include conf.d/auth-sql.conf.ext
# auth-sql.conf.ext userdb { driver = prefetch }
# 10-mail.conf mail_location = maildir:/home/vmail/%d/%n first_valid_uid = 101 first_valid_gid = 12
# 10-master.conf service auth { unix_listener auth-userdb { mode = 0666 user = vmail group = mail } unix_listener /var/spool/postfix/private/auth { mode = 0666 user = postfix group = postfix } } service dict { unix_listener dict { mode = 0666 user = vmail group = mail } }
# 10-ssl.conf ssl_cert =
# 15-lda.conf postmaster_address = postmaster@$your_domain_tld protocol lda { mail_plugins = quota sieve } lda_mailbox_autocreate = yes lda_mailbox_autosubscribe = yes
# 20-imap.conf imap_client_workarounds = delay-newmail protocol imap { mail_plugins = quota imap_quota trash }
# 20-lmtp.conf lmtp_save_to_detail_mailbox = yes protocol lmtp { mail_plugins = sieve }
# 20-managesieve.conf service managesieve-login { inet_listener sieve { port = 4190 } service_count = 1 process_min_avail = 0 vsz_limit = 64M }
# 20-pop3.conf pop3_client_workarounds = outlook-no-nuls oe-ns-eoh protocol pop3 { mail_plugins = quota }
# 90-acl.conf plugin { acl = vfile:/etc/dovecot/global-acls:cache_secs=300 }
# 90-quota.conf plugin { quota = dict:user::proxy::sqlquota trash = /etc/dovecot/dovecot-trash.conf.ext }
# 90-sieve.conf plugin { sieve_before = /home/sieve/globalfilter.sieve } EOF
participants (4)
-
chaouche yacine
-
Rob McAninch
-
Robert Moskowitz
-
Steffen Kaiser