> Charlie Garrison wrote:
>> Is there a proper way to delete a domain which is currently configured
>> as the primary domain for an account? And I want one of the current
>> domain aliases to become the primary domain.
>> I can't find any comprehensive documentation for vdeldomain. Maybe it
>> will do what I want; I don't have a test system to try it on though.
> An alias is just that, an alias.  It is not an actual domain.  If you
> delete
> the primary, the alias will not function because there is no primary
> domain
> data for it to alias.
I've actually done this before (using the MySQL back-end), but it's not
pretty.  First off, you pretty much have to turn off mail services while
you do this, or you're gonna lose mail.  Have a secondary MX hold delivery
if you have one, but it's probably even better to just not accept any
inbound connections to the servers that are listed as MXs for the domains
in question.

The way I did it was as follows:

0) Take a backup of absolutely everything related to your mail server and
keep it handy (but also create an offline copy for safekeeping).
1) Delete the alias domain that you want to become primary - I know this
sounds counter intuitive, but you MUST remove it before you can change the
old primary to the new one.
2) Rename the domain directory in vpopmail/domains to match the new primary.
3) Change all references from the old primary to the new primary in the
vpopmail DB.  IOW, it's a global search and replace.
4) Change all references from the old primary to the new primary anywhere
you find it in /var/qmail/{alias|control|users}
5) Triple-check that there are no more references to the old domain
ANYWHERE in the control structure for qmail, vpopmail, and any other
things you use.  For example, a spamassassin or squirrelmail preferences
6) Once you have completely changed everything, restart local delivery and
inject a test message to the queue.  If that works, start up SMTP locally
(set up an SMTP instance on localhost for testing if you can, otherwise
use a firewall or temporary tcprules file to deny access from the outside)
and test sending a message all the way through.  If that works, test any
other services you provide (POP/IMAP/Webmail etc.) to make sure that they
all work.  Assuming you don't have any problems, open things up to the
outside world.
7) KEEP A CLOSE EYE ON THINGS FOR AT LEAST 48 HOURS - sometimes you miss a
tiny thing and it won't show up right away, so be on the lookout for

One last thing - just to be clear.  I did this for a small domain with
only a couple of users on a server that wasn't very busy and that I had
total control over.  I also had the luxury of being able to lose a little
mail because we were in test mode at the time so that was acceptable.  I
make NO GUARANTEES that this will work without problems in a production
environment.  When in doubt, DON'T DO THIS.

Now, if you just want to stop receiving email for the primary domain and
not delete it completely, take your server out of the MX entry, point the
domain A record somewhere that doesn't accept mail, and/or add the domain
to qmail's badmailto file (assuming you have that patch installed).


Joshua Megerman
SJGames MIB #5273 - OGRE AI Testing Division
You can't win; You can't break even; You can't even quit the game.
  - Layman's translation of the Laws of Thermodynamics


Reply via email to