I host two email servers, example1.com and example2.net. How can I configure Dovecot 2.4 to distinguish between the two?
Ken
I think you need proxy solution on top of dovecot, e.g create two subdomains allocating one for each server and configure dovecot with each, and use haproxy to forward each subdomain requests to each server mta or mail server(imap, pop3) i.e. dovecot ports.
On 2025-02-10 13:21, Ken Wright via dovecot wrote:
I host two email servers, example1.com and example2.net. How can I configure Dovecot 2.4 to distinguish between the two?
Ken
dovecot mailing list -- dovecot@dovecot.org To unsubscribe send an email to dovecot-leave@dovecot.org
Ken, would help if you would give a bit more context or information what exactly do you want to achive?
Aki
On 10/02/2025 15:57 EET Zakaria via dovecot <dovecot@dovecot.org> wrote:
I think you need proxy solution on top of dovecot, e.g create two subdomains allocating one for each server and configure dovecot with each, and use haproxy to forward each subdomain requests to each server mta or mail server(imap, pop3) i.e. dovecot ports.
On 2025-02-10 13:21, Ken Wright via dovecot wrote:
I host two email servers, example1.com and example2.net. How can I configure Dovecot 2.4 to distinguish between the two?
Ken
dovecot mailing list -- dovecot@dovecot.org To unsubscribe send an email to dovecot-leave@dovecot.org
dovecot mailing list -- dovecot@dovecot.org To unsubscribe send an email to dovecot-leave@dovecot.org
Sorry, I sent that this morning just before running off to my job. Here's the section of dovecot.conf that I'm working on:
ssl_server_cert_file = /etc/letsencrypt/live/mailserver.example1.com/fullchain.pem ssl_server_key_file = /etc/letsencrypt/live/mailserver.example1.com/privkey.pem
local 127.0.0.1 { local_name mailserver.example1.com { protocol imap { ssl_server_cert_file = /etc/letsencrypt/live/mailserver.example1.com/fullchain.pem ssl_server_key_file = /etc/letsencrypt/live/mailserver.example1.com/privkey.pem } }
local_name mail.example2.net { protocol imap { ssl_server_cert_file = /etc/letsencrypt/live/mail.example2.net/fullchain.pem ssl_server_key_file = /etc/letsencrypt/live/mail.example2.net/privkey.pem } } }
When I was running Dovecot 2.3, I was able to send and receive email to and from example1.com and example2.net. I want to be able to do the same with 2.4, but right now when I try to start Dovecot I get an error message like this:
doveconf: Fatal: Error in configuration file /etc/dovecot/dovecot.conf line 42: Unknown section name: local
I tried to follow the documentation for using local and local_name but I've obviously made a horrible mistake.
Ken
On Mon, 2025-02-10 at 16:11 +0200, Aki Tuomi wrote:
Ken, would help if you would give a bit more context or information what exactly do you want to achive?
Aki
On 10/02/2025 15:57 EET Zakaria via dovecot <dovecot@dovecot.org> wrote:
I think you need proxy solution on top of dovecot, e.g create two subdomains allocating one for each server and configure dovecot with each, and use haproxy to forward each subdomain requests to each server mta or mail server(imap, pop3) i.e. dovecot ports.
On 2025-02-10 13:21, Ken Wright via dovecot wrote:
I host two email servers, example1.com and example2.net. How can I configure Dovecot 2.4 to distinguish between the two?
Ken
dovecot mailing list -- dovecot@dovecot.org To unsubscribe send an email to dovecot-leave@dovecot.org
dovecot mailing list -- dovecot@dovecot.org To unsubscribe send an email to dovecot-leave@dovecot.org
On 11. Feb 2025, at 2.09, Ken Wright via dovecot <dovecot@dovecot.org> wrote:
Sorry, I sent that this morning just before running off to my job. Here's the section of dovecot.conf that I'm working on:
Nothing wrong with that part.
When I was running Dovecot 2.3, I was able to send and receive email to and from example1.com and example2.net. I want to be able to do the same with 2.4, but right now when I try to start Dovecot I get an error message like this:
doveconf: Fatal: Error in configuration file /etc/dovecot/dovecot.conf line 42: Unknown section name: local
This most likely means you forgot to close with } an earlier section. v2.4.0 unfortunately gives a rather bad error message in that case. It'll be better in v2.4.1.
On Tue, 2025-02-11 at 10:14 +0200, Timo Sirainen wrote:
On 11. Feb 2025, at 2.09, Ken Wright via dovecot <dovecot@dovecot.org> wrote:
Sorry, I sent that this morning just before running off to my job. Here's the section of dovecot.conf that I'm working on:
Nothing wrong with that part.
When I was running Dovecot 2.3, I was able to send and receive email to and from example1.com and example2.net. I want to be able to do the same with 2.4, but right now when I try to start Dovecot I get an error message like this:
doveconf: Fatal: Error in configuration file /etc/dovecot/dovecot.conf line 42: Unknown section name: local
This most likely means you forgot to close with } an earlier section. v2.4.0 unfortunately gives a rather bad error message in that case. It'll be better in v2.4.1.
I've searched the dovecot.conf file thoroughly and can't find any unclosed brackets. Should I post the whole thing (with appropriate obfuscation, of course)?
Ken
On 11.02.25 13:26, Ken Wright via dovecot wrote:
I've searched the dovecot.conf file thoroughly and can't find any unclosed brackets. Should I post the whole thing (with appropriate obfuscation, of course)?
A quick check would be if there is a different count { and }: diff <(grep -E "}" -c -r /etc/dovecot) <(grep -E "}" -c -r /etc/dovecot)
This executes grep -E "}" -c -r /etc/dovecot and grep -E "}" -c -r /etc/dovecot and prints any differences via diff
-- Regards Andreas Haerter
foundata GmbH Steinhäuserstr. 20 76135 Karlsruhe
Sitz der Gesellschaft: Karlsruhe Registergericht: Amtsgericht Mannheim, HRB 714807 Geschäftsführung: Andreas Haerter USt-IdNr.: DE284122682
On 13.02.25 20:40, Andreas Haerter via dovecot wrote:
On 11.02.25 13:26, Ken Wright via dovecot wrote:
I've searched the dovecot.conf file thoroughly and can't find any unclosed brackets. Should I post the whole thing (with appropriate obfuscation, of course)?
A quick check would be if there is a different count { and }: diff <(grep -E "}" -c -r /etc/dovecot) <(grep -E "}" -c -r /etc/dovecot)
This executes grep -E "}" -c -r /etc/dovecot and grep -E "}" -c -r /etc/dovecot and prints any differences via diff
Sorry, I switched { in the first calls. Correct is the following for sure:
A quick check would be if there is a different count of "{" and "}": diff <(grep -E "{" -c -r /etc/dovecot) <(grep -E "}" -c -r /etc/dovecot)
This executes grep -E "{" -c -r /etc/dovecot and grep -E "}" -c -r /etc/dovecot and prints any differences via diff
-- Regards, Andreas Haerter
foundata GmbH Steinhäuserstr. 20 76135 Karlsruhe
Sitz der Gesellschaft: Karlsruhe Registergericht: Amtsgericht Mannheim, HRB 714807 Geschäftsführung: Andreas Haerter USt-IdNr.: DE284122682
Okay, here's dovecot.conf in its entirety (with strategic obfuscation, of course).
## Dovecot configuration shipped with debian packages
dovecot_config_version = 2.4.0 dovecot_storage_version = 2.4.0
protocols = imap lmtp sieve lda
!include_try conf.d/*.conf
auth_mechanisms = plain login
sql_driver = mysql
# The mysqld.sock socket may be in different locations in different systems. mysql /var/run/mysqld/mysqld.sock { user = MariaDBuser password = MariaDBpassword dbname = MariaDBdatabase
#ssl = yes #ssl_client_ca_dir = /etc/ssl/certs } # Alternatively you can connect to localhost as well: #mysql localhost { #}
passdb_default_password_scheme = SomethingSecure
passdb sql { query = SELECT user AS username, domain, password FROM mailbox WHERE user = '%{user | username}' AND domain = '%{user | domain}' AND active= '1' } userdb sql { query = SELECT home, uid, gid FROM mailbox WHERE user = '%{user | username}' AND domain = '%{user | domain}' AND active= '1' # For using doveadm -A: iterate_query = SELECT user AS username, domain FROM mailbox }
ssl_server_cert_file = /etc/letsencrypt/live/mailserver.example1.com/fullchain.pem ssl_server_key_file = /etc/letsencrypt/live/mailserver.example1.com/privkey.pem
local 127.0.0.1 { local_name mailserver.example1.com { protocol imap { ssl_server_cert_file = /etc/letsencrypt/live/mailserver.example1.com/fullchain.pem ssl_server_key_file = /etc/letsencrypt/live/mailserver.example1.com/privkey.pem } }
local_name mail.example2.net { protocol imap { ssl_server_cert_file = /etc/letsencrypt/live/mail.example2.net/fullchain.pem ssl_server_key_file = /etc/letsencrypt/live/mail.example2.net/privkey.pem } } }
Timo suggested there might be an unclosed { somewhere before the section with the cert files, but I don't see any. Does anyone see what I've missed?
Ken
On Tue, 2025-02-11 at 10:14 +0200, Timo Sirainen wrote:
On 11. Feb 2025, at 2.09, Ken Wright via dovecot <dovecot@dovecot.org> wrote:
Sorry, I sent that this morning just before running off to my job. Here's the section of dovecot.conf that I'm working on:
Nothing wrong with that part.
When I was running Dovecot 2.3, I was able to send and receive email to and from example1.com and example2.net. I want to be able to do the same with 2.4, but right now when I try to start Dovecot I get an error message like this:
doveconf: Fatal: Error in configuration file /etc/dovecot/dovecot.conf line 42: Unknown section name: local
This most likely means you forgot to close with } an earlier section. v2.4.0 unfortunately gives a rather bad error message in that case. It'll be better in v2.4.1.
Do you have something under conf.d? Aki On 12/02/2025 03:42 EET Ken Wright via dovecot <dovecot@dovecot.org> wrote: Okay, here's dovecot.conf in its entirety (with strategic obfuscation, of course). ## Dovecot configuration shipped with debian packages dovecot_config_version = 2.4.0 dovecot_storage_version = 2.4.0 protocols = imap lmtp sieve lda !include_try conf.d/*.conf auth_mechanisms = plain login sql_driver = mysql # The mysqld.sock socket may be in different locations in different systems. mysql /var/run/mysqld/mysqld.sock { user = MariaDBuser password = MariaDBpassword dbname = MariaDBdatabase #ssl = yes #ssl_client_ca_dir = /etc/ssl/certs } # Alternatively you can connect to localhost as well: #mysql localhost { #} passdb_default_password_scheme = SomethingSecure passdb sql { query = SELECT user AS username, domain, password FROM mailbox WHERE user = '%{user | username}' AND domain = '%{user | domain}' AND active= '1' } userdb sql { query = SELECT home, uid, gid FROM mailbox WHERE user = '%{user | username}' AND domain = '%{user | domain}' AND active= '1' # For using doveadm -A: iterate_query = SELECT user AS username, domain FROM mailbox } ssl_server_cert_file = /etc/letsencrypt/live/mailserver.example1.com/fullchain.pem ssl_server_key_file = /etc/letsencrypt/live/mailserver.example1.com/privkey.pem local 127.0.0.1 { local_name mailserver.example1.com { protocol imap { ssl_server_cert_file = /etc/letsencrypt/live/mailserver.example1.com/fullchain.pem ssl_server_key_file = /etc/letsencrypt/live/mailserver.example1.com/privkey.pem } } local_name mail.example2.net { protocol imap { ssl_server_cert_file = /etc/letsencrypt/live/mail.example2.net/fullchain.pem ssl_server_key_file = /etc/letsencrypt/live/mail.example2.net/privkey.pem } } } Timo suggested there might be an unclosed { somewhere before the section with the cert files, but I don't see any. Does anyone see what I've missed? Ken On Tue, 2025-02-11 at 10:14 +0200, Timo Sirainen wrote: On 11. Feb 2025, at 2.09, Ken Wright via dovecot <dovecot@dovecot.org> wrote: Sorry, I sent that this morning just before running off to my job. Here's the section of dovecot.conf that I'm working on: Nothing wrong with that part. When I was running Dovecot 2.3, I was able to send and receive email to and from example1.com and example2.net. I want to be able to do the same with 2.4, but right now when I try to start Dovecot I get an error message like this: doveconf: Fatal: Error in configuration file /etc/dovecot/dovecot.conf line 42: Unknown section name: local This most likely means you forgot to close with } an earlier section. v2.4.0 unfortunately gives a rather bad error message in that case. It'll be better in v2.4.1. _______________________________________________ dovecot mailing list -- dovecot@dovecot.org To unsubscribe send an email to dovecot-leave@dovecot.org
On Wed, 2025-02-12 at 07:32 +0200, Aki Tuomi wrote:
Do you have something under conf.d?
Here are all the files under conf.d with almost all the superfluous comments deleted.
10-auth.conf:
passdb sql { query = SELECT username AS user, password FROM mailbox WHERE username = '%{user}' AND active='1' query = SELECT maildir, 2000 AS uid, 2000 AS gid FROM mailbox WHERE username = '%{user}' AND active= '1'}
10-mail.conf:
mail_driver = maildir mail_home = %{home} mail_path = ~/mail mail_inbox_path = /var/vmail/%{user | username } mailbox_list_utf8 = yes
namespace inbox { separator = / inbox = yes }
10-ssl.conf:
ssl = required ssl_server_prefer_ciphers = server
15-mailboxes.conf:
namespace inbox { # These mailboxes are widely used and could perhaps be created automatically: mailbox Drafts { auto = create special_use = \Drafts } mailbox Junk { auto = create special_use = \Junk } mailbox Trash { auto = create special_use = \Trash }
# For \Sent mailboxes there are two widely used names. We'll mark both of # them as \Sent. User typically deletes one of them if duplicates are created. mailbox Sent { auto = create special_use = \Sent
20-imap.conf:
protocols { imap = yes }
20-lmtp.conf:
protocols { lmtp = yes }
20-managesieve.conf:
protocols { sieve = yes }
auth-checkpassword.conf.ext:
passdb passwords { driver = checkpassword args = /usr/bin/checkpassword }
# passdb lookup should return also userdb info userdb users { driver = prefetch }
auth-deny.conf.ext:
passdb passwd-file { driver = passwd-file deny = yes
# File contains a list of usernames, one per line args = /etc/dovecot/deny-users }
auth-dict.conf.ext:
passdb AuthDatabase { driver = dict
# Path for dict configuration file, see # example-config/dovecot-dict-auth.conf.ext args = /etc/dovecot/dovecot-dict-auth.conf.ext }
userdb AuthDict { driver = dict args = /etc/dovecot/dovecot-dict-auth.conf.ext }
auth-master.conf.ext:
passdb passwd-file { driver = passwd-file master = yes args = /etc/dovecot/master-users
# Unless you're using PAM, you probably still want the destination user to # be looked up from passdb that it really exists. pass=yes does that. pass = yes }
auth.passwdfile.conf.ext:
passdb PasswdFile { driver = passwd-file args = scheme=CRYPT username_format=%u /etc/dovecot/users }
userdb PasswdFile { driver = passwd-file args = username_format=%u /etc/dovecot/users }
auth-sql.conf.ext:
passdb SQL { driver = sql
# Path for SQL configuration file, see example-config/dovecot- sql.conf.ext args = /etc/dovecot/dovecot-sql.conf.ext } userdb SQL { driver = sql args = /etc/dovecot/dovecot-sql.conf.ext }
auth-system.conf.ext:
passdb PAM { driver = pam # [session=yes] [setcred=yes] [failure_show_msg=yes] [max_requests=<n>] # [cache_key=<key>] [<service name>] #args = dovecot } userdb PAM { # <doc/wiki/AuthDatabase.Passwd.txt> driver = passwd # [blocking=no] #args =
# Override fields from passwd #override_fields = home=/home/virtual/%u }
On 13. Feb 2025, at 1.42, Ken Wright <daddywarlock@gmail.com> wrote:
On Wed, 2025-02-12 at 07:32 +0200, Aki Tuomi wrote:
Do you have something under conf.d?
Here are all the files under conf.d with almost all the superfluous comments deleted.
10-auth.conf:
passdb sql { query = SELECT username AS user, password FROM mailbox WHERE username = '%{user}' AND active='1' query = SELECT maildir, 2000 AS uid, 2000 AS gid FROM mailbox WHERE username = '%{user}' AND active= '1'}
If } isn't here on its own line, that's one explanation.
15-mailboxes.conf:
namespace inbox { # These mailboxes are widely used and could perhaps be created automatically: mailbox Drafts { auto = create special_use = \Drafts } mailbox Junk { auto = create special_use = \Junk } mailbox Trash { auto = create special_use = \Trash }
# For \Sent mailboxes there are two widely used names. We'll mark both of # them as \Sent. User typically deletes one of them if duplicates are created. mailbox Sent { auto = create special_use = \Sent
Also here seems to be missing two } lines.
On Thu, 2025-02-13 at 07:55 +0200, Timo Sirainen wrote:
On 13. Feb 2025, at 1.42, Ken Wright <daddywarlock@gmail.com> wrote:
On Wed, 2025-02-12 at 07:32 +0200, Aki Tuomi wrote:
Do you have something under conf.d?
Here are all the files under conf.d with almost all the superfluous comments deleted.
10-auth.conf:
passdb sql { query = SELECT username AS user, password FROM mailbox WHERE username = '%{user}' AND active='1' query = SELECT maildir, 2000 AS uid, 2000 AS gid FROM mailbox WHERE username = '%{user}' AND active= '1'}
If } isn't here on its own line, that's one explanation.
Fixed that; thanks for pointing it out!
15-mailboxes.conf:
namespace inbox { # These mailboxes are widely used and could perhaps be created automatically: mailbox Drafts { auto = create special_use = \Drafts } mailbox Junk { auto = create special_use = \Junk } mailbox Trash { auto = create special_use = \Trash }
# For \Sent mailboxes there are two widely used names. We'll mark both of # them as \Sent. User typically deletes one of them if duplicates are created. mailbox Sent { auto = create special_use = \Sent
Also here seems to be missing two } lines.
Apparently I cut off the copy two lines short. My bad.
Tried starting Dovecot again, this time got an "unknown protocol" error about lda. Took that out of dovecot.conf and it started fine.
So why can't I log in from Evolytion? Here's the error message Evo gives me:
Temporary authentication failure. [mailserver.example1.com:2025-02-13 12:37:22]
Ken
On Mon, Feb 10, 2025 at 4:34 PM Ken Wright via dovecot <dovecot@dovecot.org> wrote:
I host two email servers, example1.com and example2.net. How can I configure Dovecot 2.4 to distinguish between the two?
Hi Ken,
Look at these:
- https://doc.dovecot.org/2.3/configuration_manual/howto/simple_virtual_instal...
- https://doc.dovecot.org/2.3/configuration_manual/virtual_users/
-- Best regards, Odhiambo WASHINGTON, Nairobi,KE +254 7 3200 0004/+254 7 2274 3223 In an Internet failure case, the #1 suspect is a constant: DNS. "Oh, the cruft.", egrep -v '^$|^.*#' ¯\_(ツ)_/¯ :-) [How to ask smart questions: http://www.catb.org/~esr/faqs/smart-questions.html]
participants (6)
-
Aki Tuomi
-
Andreas Haerter
-
Ken Wright
-
Odhiambo Washington
-
Timo Sirainen
-
Zakaria