June 22, 2012

Dedicated Servers Running Virtualmin and Email SPAM

I rent two dedicated servers that run Virtualmin control panel and have to admit that though I'm very good with dealing with websites and the day to day running of a server, when it comes to fixing technical problems I STRUGGLE!

One of my dedicated servers has been having problems and by luck I think I finally solved the problem (or one of them anyway).

I have about 100 domains, about 80 on one server and 20 on the other. I used Virtualmin as the control panel which overall I'm quite satisfied with. When you setup an new virtual server using Virtualmin it automatically sets up a catchall email address, which will catch all email to @yourdoamin.tld minus any specific email addresses you setup later.

So I had 80 domains on a server with about 75 not being used by me to collect email, this meant there was about 75 domains collecting SPAM and webmaster@, postmaster@, abuse@ type emails. All these emails where building up over the last year resulting in many GBs of wasted disk space! What's much worse than the wasted disk space is each time a new email arrived it would have to be added to some quite large files which I understand results in high memory usage which is a bad thing when it comes to server management.

One domain in particular had 1/4 of a million SPAM emails! in a file over 1GB in size!

So if like me you have domains that you don't want email collected (so you don't need an email server), disable the email server.

In Virtualmin it's quite easy, go to the Edit Virtual Server page and under enable Features untick the Mail for domain enabled? box. If you have SPAM and Virus filtering enabled also untick them since you can't have those enabled when mail for domain is disabled. This will disable email collection.

If you already have a problem with massive email files under Virtualmin before you disable the email server you should delete the email since disabling the email server doesn't delete the currently collected email.

Virtualmin comes with Postfix Mail Server which can be used to delete email from the server. Unfortunately it's not completely straight forward to delete email from the server if you have 10s of thousands of emails (takes ages to load a page), so best way using Virtualmin (there's probably an even easier command line way ) is to delete all email from a server, to do this you have to make a settings change first.

Click the System Information link on the left menu.

Status link on the right, followed by the Manage Mail Server link/button under Postfix Mail Server

Click User Mailboxes and on the next page (which could take ages to load if you have a lot of mail) the Module Config link at the top of the page.

Under those settings tick the Show button to delete entire mailbox? setting, save and go back to the User Mailboxes page.

Under this page is a list of all the mailboxes on the server, if your servers been running a while there could be some very large files (the size of each file is listed). Open them one at a time (ideally in a new window so you don't have to reload the User Mailbox page) and there will be a Delete All button, click it and all the email from that server will be deleted (one down, 74 to go ).

Do this for all the large mail files you never wanted to collect email with and then disable them as described earlier. this could make a big difference to server performance.