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 The idea is basically:

Ham → → → → Deliver

Spam → → → Gmail Spam folder

At the top of my .procmailrc file (which handles all mail sent to, 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 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 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 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.

RewriteEngine on

RewriteCond %{SERVER_NAME} .*craftlog\.org$
RewriteRule ^index.html$ craftlog/ [L]

RewriteCond %{SERVER_NAME} .*princetonjudo\.(org|net)$
RewriteRule ^index.html$ princetonjudo/ [L]

RewriteCond %{SERVER_NAME} .*oomny\.net$
RewriteCond %{REQUEST_URI} !^/oomny/.*$
RewriteRule ^(.*)$ oomny/$1 [L] and are both Movable Type blogs stored in subdirectories of the document root. Requests for the front pages of each site are rewritten to requests for their subdirectories. 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.