May 20, 2007

Spam filtering with Gmail

Pair's default spam filtering options are pathetic. SpamAssassin is wholly inadequate, and after 2 months of trying, I still couldn't get Bayes to work. So I finally gave up, disabled spam filtering, and am now using a Gmail account as the spam filter for all of my Pair aliases. I configured the Gmail account to forward messages to gmail@huangfamily.com. The idea is basically:

At the top of my .procmailrc file (which handles all mail sent to @huangfamily.com), I added the following rule:

The rule basically says, send all new messages to Gmail, and if they return, deliver them. Since Gmail doesn't forward spam, only clean messages will return. To prevent loops, the rule checks for the X-Forwarded-For header set by Gmail when it forwards messages. Messages sent directly to gmail@huangfamily.com are dropped.

I suppose that a smart spam bot could fake the X-Forwarded-For header. They can't fake Received headers, though, so if this starts happening, I could replace the condition with one that checks that the message was sent from a google.com relay.

July 11, 2006

pair Networks

Maitreya and I host several domains and Movable Type blogs with a single Advanced Account at pair Networks. pair is a little more expensive than their competitors, like DreamHost, but I like them because they're based in Pittsburgh, don't oversubscribe, never have downtime, and provide easy-to-use configuration tools. They've also never implemented stupid policies like counting your CPU minutes. They've been in business a long time and understand the business of shared hosting.

Here's a trick I use to host several different websites on huangfamily.com without having to pay for additional virtual domains each month. I had to pay one-time vanity domain charges for each site, but I use the magic of mod_rewrite in an .htaccess file to provide the illusion that each site is hosted separately.

craftlog.org and princetonjudo.org are both Movable Type blogs stored in subdirectories of the huangfamily.com document root. Requests for the front pages of each site are rewritten to requests for their subdirectories. oomny.net is Ariel's website hand-coded in WordPad. Requests to Ariel's site are silently prepended with oomny/. I gave her full FTP access to the oomny/ subdirectory and just told her to code as if it were the document root of her server.