Score:0

Dovecot and Exim config to support domain alias

us flag

I use Dovecot and Exim in my mail server, and auth them against MariaDB. The server keep mails for multiply mail domain, and it works this way for years.

Now I need to migrate (rename) one of mail domains into another name (don't ask, business demands that), so all mailboxes in first (old) domain should have the same local_part in second (new) domain:

To simplify the transition, I try to implement this logic:

  • whatever domain (old or new) user uses to auth itself to send or receive mail, it should be accepted (if password fits);
  • mail should be served from the same (named after old domain) directory on the server
  • if user sends mail originated from his box in old domain, Exim should rewrite old email into new email in the headers.

After this will be in effect I can slowly reconfigure clients so they be authed with new domain-based email addresses instead of old domain-based.

This will give me (and users) smooth transition into new domain, and it sounds nice.

So to say, sound nice, but can't figure out how to implement that in a nice way.

If the new domain be the only one, I can put that logic into SQL requests in Dovecot and Exim. But this time I need to deal with several such "renamed" domains, and it looks too tricky to hard-code these domains names into SQL queries.

I created new table and store old/new domains pairs there, like this:

  • 'olddomain1.com', 'newdomain1.com'
  • 'olddomain2.com', 'newdomain2.com'
  • etc

But this time I doubt I can use this replacement table along in queries to auth. Dovecot, so to say, won't allow severay different queries to be used to get iterate_query or user_query reply.

Please advice how would you implement that domain rename case!

Thank you in advance!

anx avatar
fr flag
anx
What makes you think you need multiple different queries? Dovecot does not really care how your query works as long as it works - it is perfectly okay for that SQL template to join multiple tables.
anx avatar
fr flag
anx
Depending on MUAs used, you will still encounter some not very smooth scenarios. If a mail received via the new domain is to be responded by a not-yet-reconfigured, that client may not know how select the correct sender address/display name/signature.
anx avatar
fr flag
anx
To be honest this sounds more like a good reason to establish a proper way to ship MUA configuration to company assets than a good reason to create a whole bunch of really weird edge cases just to allow for a longer-term transition. Only forwarding incoming messages to the new canonical domain and switching the clients "instantaneously" (during planned downtime or as soon as they go online after that) may cause less total disturbance.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.