Saturday, 20 February 2016

Fettling the mail server

Actually, I have several mail servers. I also use AOL and Gmail. But I don't want to bob about between different user interfaces, and have to log in to various places to do all my mail. So I use fetchmail.

The server that this runs on, is what I call my main mail server. It polls each of the places that I get mail at (and if there's a service like Facebook or that doesn't allow  me to pick up my messages using POP or IMAP, then I don't use it. Tough.)

And my mail server, Sadih, developed a bad sector on the SD card.

This isn't a disaster, it just meant that there was a file that wasn't readable, and it wasn't an important file. But I don't want my main mail server to be failing - one bad sector can be the precursor of many more. So I decided to set up a new main mail server.

I've done this a few times. The first time was when I switched it from a full-sized server to a small computer. The second time what when I switched it to a Raspberry Pi. The third time was when I switched to a Pi 2, and now another switch. The new server will be called Sadii (because there was Sadie, Sadif, Sadig and Sadih, and before that, Zelda).

So first I checked for the latest linux on the Pi, and it's just been updated, a couple of weeks ago. Debian Jessie. So I downloaded that, and splatted it onto a 32 gb SD card. Because I had one.

Then I used apt-get to install all the necessary software, such as samba. And then the software that my despammer uses.

I've talked about my despammer before. I made it myself, and I'd use nothing else. I also configured Alpine (a clone of Pine); the most important part is to sort email by subject header. That helps when I check my spam folder. But Pine does other good stuff; it shows me where a link really goes, not just where the spammer says it goes.

Then the crontabs. One of them, once per minute, checks each of my servers to see if it's reporting that it has any problems. If it can't contact the server, that counts as a problem, of course. So when I look at my "alerts" folder, I can see which servers are comlaining. And also, once per minute, a program counts those alerts, and a Raspberry Pi displays that number on a big screen.

The biggest problem I had, was with DNS. There was a time when you set up resolv.conf with the IP address of your DNS server, and that was that. But now there's a thing that creates resolv.conf for you, and overwrites the one I ser up. It's called resolvconf, and you deal with this by setting up resolvconf.conf to tell resolvconf what you want to have in resolv.conf. I'm sure there's a good reason for this, but I don't know what it is.

So then I tested the whole thing by emailed one of my AOL accounts, and it worked. Plus, spam is flowing in (and being put into the spam folder).

Job done.

No comments:

Post a Comment