Skip to content

There's a hell of a lot more to me

This weekend has been an interesting mix of activities. Mostly I've been tweaking my mail filtering service now that it has more users it is more interesting to do that.

The basic process of mail-scanning is pretty simple, but there are some fun things in the mix which make it slightly more fiddly than I'd like.

The basic recipe goes something like this:

  • Accept mail.
  • Validate the mail is addressed to a domain hosted upon the machine.
  • Do the spam filtering / magic (many steps missing here)
    • If the mail should be rejected archive it to a local Maildir folder and bounce it.
    • If the mail should be accepted then forward it to the destination machine.

The archiving of all rejected messages is a big win. It means that if there is a mistake in the handling of any mail we could undo it, retraining the spam database etc. It also provides, via a web page/rss feed, a way for a user to see what a good job the filtering system is doing - by saying "Here's what you would have had ..".

Today I switched the way that the archived mail is displayed via the Web GUI. Previously I used some nasty Maildir parsing code, but now I'm running IMAP upon localhost - so the viewing of messages is a lot more straightforward. (via Net::IMAP::Simple.)

More interestingly, to most readers I'm sure, today I managed to take a new Kite out for flying. A cold and windy day, but lots of fun. There was beer, pies, and near-death!

This was also the second weekend I carried out some painting of my front room. At this rate I'll have painted all four walls of the room in less than two months! (The last time I painted a room it took approximately six months to complete. Move furnuture & paint one wall. Wait several weeks, then repeat until all walls are complete!)

Comments On This Entry

  1. [gravitar] cstamas
    Bounces are considered a big NO-NO in email. I understand your reasoning, but this way you are generating back-scatter. More on backscatter: http://www.postfix.org/BACKSCATTER_README.html If you really want to reject do it before accepting it! IMHO. -- cstamas
  2. [author] Steve

    Thanks for the comment. Yes you are correct if I did bounce it then I would be causing problems.

    I didn't describe the process correctly - when I said bounce I do mean give a 5xx code after the DATA command has been received.

    So the result is an SMTP-time failure, and not a bounce. It is literally the earliest I can do it - I need the full body to be received so I can archive it. (Also I guess if it wasn't stopped via an earlier method I need the body to hand to run the virus/spam scanning upon!)

    So, all in all, I think I'm actually behaving correctly.

  3. [gravitar] cstamas
    Oh, that is OK. (Rejecting during SMTP conversation). Reading your blog made me think the opposite. -- cstamas
  4. [gravitar] Dan C
    OT- What kind of kite?
  5. [author] Steve Kemp

    Not off-topic at all!

    The kite is a generic box-kite - the first time I've ever flown one of those, but it was a lot of fun!