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!
0 Answers