February, 2009:

OpenVPN in VirtualBox

Send to Kindle

There are a number of reasons why you might want to run a VPN on your laptop. The most obvious is that you have to, in order to access files back at the office. Two other likely reasons are security (you are in a public place, and want to encrypt all traffic) and unfettered access (your provider is blocking certain ports or services).

I’ve been interested in implementing a VPN for a while now, but haven’t had any real need, nor tons of copious free time. On Friday, I was informed that one of my portfolio companies had installed OpenVPN and I was welcome to install a client and test it.

I am running Windows Vista Ultimate x64 (the x64 sometimes being problematic with certain software). It turns out that the latest release candidate for OpenVPN has full Windows x64 support, so that wasn’t going to be an issue.

I installed the software, edited the configuration files that the office sent me, fired it up, and it worked the first time. Cool. I tested a few things, including accessing hosts that I wouldn’t be able to see unless I was in the office, and it all seemed to work correctly.

Then I hit a small snag. I tried to fire up my fat-client brokerage application. It behaved as if I didn’t have a network connection, or more accurately, like it couldn’t find the server it wanted to home to. I suspect that this could be something as simple as whether the office itself is set up to route out this type of app/port/protocol through the VPN (I know for a fact that this specific app works when I am in the office).

I also suspect that other fat clients, like a Poker app, might have similar troubles. That got me thinking about the additional use cases beyond just needing access to files/apps/machines in the office.

I fired up VirtualBox, specifically with my new favorite Sidux distribution. I tried to install openvpn from the repo, but it wasn’t found. A Google search said that openvpn is included in Debian itself (which Sidux is based on), so I was temporarily puzzled. I had the following line in my sources:

deb http://ftp.us.debian.org/debian/ sid main

I added another line, identical to the one above, substituting de for us. Presto, openvpn was found, and installed smoothly.

I copied over the same config files from my Windows directory, fired up OpenVPN, and was connected to the office again. This time though, in a pretty cool configuration. Everything in Linux (Sidux), was routed through the VPN. Everything in Windows, was routed normally though my FiOS connection.

If I wanted access to something on the corporate lan, use the browser in Sidux. The brokerage app just worked as normal, as it was unaware of the VPN. On a number of levels, this is the best of both worlds.

Of course, I already summarized situations when you may want/need the full VPN, for the entire machine, or when this use case might be better. If you’re in a public hotspot, and want everything encrypted, even your personal surfing, the Windows-level VPN makes sense.

If you’re in a client’s office, and can’t connect to an odd port on your home server (e.g., you have an application running at http://www.mycompany.com:8765/) which is blocked by your client’s firewall, then you fire up the VPN in the VM, and use that browser, while not disturbing the rest of the applications on your desktop.

This also gave me the idea that since putting Linux on a USB stick is so trivial (see this post about multi-boot USB), it would be simple to have a bootable USB stick, with the OpenVPN client on it (password-protected, of course), that would allow you to boot off any PC/laptop as if you’re in the office, or without leaving any trace on the host PC, whenever the situation called for it. Friends wouldn’t need to feel that you were seeing their browsing history, etc.

Just for yucks, I also installed OpenVPN on my server, for the secondary scenarios mentioned above (security and unfettered access). While I don’t anticipate needing them frequently, knowing that it’s available, on a second’s notice, is a comfort.

Another trick added to my bag. 🙂

Road Trip Completed

Send to Kindle

My last post covered the first half of our long road trip south. We left off on Friday February 6th, while David was still on call. After our shopping trip, Lois and I spent the rest of the day at David’s (where that post was written). We left at 8:30pm and headed to TCBY for dinner (yes, once it hit 60 degrees, after the incredible cold earlier in the week, it was time for frozen yogurt for dinner!).

We weren’t the only ones with that thought, but I’m guessing that at that hour, for most people, it was dessert, not dinner. This was also the first TCBY I’d ever seen with a drive through window. The line of cars was long, but we went in to get ours.

We then headed to Bed Bath and Beyond for some late night shopping right before they closed. We got exactly what we were looking for, thankfully.

The next morning we headed back to David’s. He got there at around noon. Typically, he naps right away, but during this call, he was able to sneak in a whopping four hours of sleep, and he had a bit more energy than usual. We headed for lunch at Jason’s Deli (very good) followed by some shopping and coffee.

Included in the shopping was an impromptu stop at a stuffed animal store. Lois has been searching for a stuffed moose for a long time, and this store had two good choices. Lois got to turn the crank on the stuffing machine, while the owner of the store held the moose in place. So, not only did Lois get to find a stuffed moose, she got to stuff it herself!

David Hadar Stuffed Animals

David Hadar Stuffed Animals

We hung around the apartment in the afternoon, and David finally took an all-too-brief nap. When we headed out again, we bought some DVD’s at Best Buy, and then headed for dinner at the same mall we had lunch in. David picked a Mexican restaurant called Cocina Superior. From the look of it (and the location), I just assumed it was a chain. But, looking at the link now, I see that this is the only location.

When we got there, it was jammed near the front desk. There were quite a number of tables open inside (the place is huge), but for whatever reason, we were told it would be a 30 minute wait. We decided to wait outside (it was on the cool side, but still nice). It took nearly 50 minutes for them to seat us. We had a great meal, so no one minded the wait after the fact.

I know there’s unreal hardship all over, but whenever I see mob scenes like this, at reasonably high-end places, I can’t help but remark to Lois: What Recession?

When we got back to David’s, we were all too pooped for a movie. Instead, David put on the first two episodes of Curb Your Enthusiasm (he had the first six episodes on a Netflix DVD). I had never seen an episode before, but lots of people told me that I would like it, especially since I loved Seinfeld.

They were correct. Larry David is essentially a successful George. He gets himself into the same situations that George would, but he’s rich and famous (and has rich and famous friends). I laughed a bunch. Definitely not Lois’ cup of tea… Since we were all pretty tired, we headed back to the hotel.

We picked David up mid-morning on Sunday, and headed for brunch at V. Richards. If you click on “About Us” you’ll see a picture of the outdoor patio where we ate. David and I both had the breakfast casserole. It was awesome.

We then headed to Vulcan Park (home of the famous Vulcan Statue). We didn’t get to see it (other than from a distance) during our last trip to Birmingham, due to bad weather. This time, it was in the upper 60’s, and we were heading there in T-Shirts!

Vulcan Structure

Vulcan Structure

On the road up the hill toward the park, I jokingly asked David whether the Vulcan was named after Spock. He chuckled and told me that ironically, Leonard Nemoy was in town two days earlier (on Friday). He had recently completed a study of obese nudes, and exhibited them in Birmingham.

Lois was in her own world in the back seat, taking dozens of pictures, not really listening to our conversation. Obviously, something caught her attention, and just as we were coming into Vulcan Park itself, she says “Who’s Obie Snoods?”

David and I just looked at each other and smiled, both assuming that Lois was just being funny. A few seconds later, she asked again “Who’s Obie Snoods?”. I then explained the conversation we just had, and when she realized it was obese nudes, she just lost it. Of course, once we saw Lois laughing uncontrollably, we lost it too.

That became a theme for the rest of the trip. At various points along the way, either I or Lois would turn to the 0ther and ask “Who’s Obie Snoods?” 🙂

The statue isn’t correctly proportioned. Both the head and the butt stick out, as you can see in this photo below:

Vulcan Proportions

Vulcan Proportions

Two more photos, one from the front and the other, a shot of the statue, behind a replica of the statue:

Vulcan Statue

Vulcan Statue

Vulcan and Replica

Vulcan and Replica

We walked around the statue and looked over the city. We then took an hour-long walk on a trail around the park. It was good to get a little exercise in, given all of the feasting we’d done the week before.

David Lois Hadar Vulcan Park

David Lois Hadar Vulcan Park

When we got back, we watched one of the DVD’s we bought the night before, Get Smart. It was one of my favorite shows growing up. While I had a real interest in seeing it, I was actually quite afraid that it would pale in comparison to the original show. I was pleasantly surprised that they did a nice job all around.

David wasn’t hungry for lunch, so Lois and I made another TCBY run, bringing it back to the apartment. Yummy.

After that, I decided to play my very first game of PlayStation 3 Football. I begged David to be gentle with me. He gave me a quick lesson on using the controller, and then suggested that I pick a very strong team (I chose the Georgia Bulldogs). He picked Duke. While a sentimental favorite for him, clearly, not a college football powerhouse.

I was surprised that I was able to hold my own during most of the game. That said, David helped me out a few times. Specifically, when my play clock was running out, he called a defensive timeout (three times, wasting all of his timeouts), saving me from a penalty. Thanks David! 🙂

In the fourth quarter, David took the lead. I then scored and took it back. We decided to head out for dinner and finish the game later. We went to Surin West, a Thai restaurant that also serves a complete Sushi selection. We all enjoyed our meals tremendously. Mine was a recommendation from the waiter, who convinced me to switch from the duck dish I ordered, to the one he said all of the waiters preferred. He also recommended the potstickers appetizer, which was heavenly.

We headed back to the apartment to finish the game. David scored to take the lead again. Since I couldn’t master any kind of kicking, I missed every extra point and field goal attempt. So, I needed to score a touchdown to win. I had 1:37 left on the clock. I was able to engineer a long drive, including finally calling timeouts myself, and I scored with 10 seconds left to take a one point lead!

So, I’m one for one and may retire with a perfect record in PlayStation 3 College Football! Of course, if David hadn’t wasted three timeouts on my behalf, or he hadn’t chosen a weak opponent to my powerhouse one, I would have been toast. Consider it beginner’s luck. Either way, I had a great time playing the game.

We watched a bit of the Grammy’s and said our final goodbyes. We had an early, and long day ahead of us.

We spent Monday in the car. Roughly 12 hours of driving, 13 hours including the time zone change. We rolled into the hotel in FL after 8pm on Monday night, completely wiped out. We spent Tuesday and Wednesday with my parents.

We had two excellent buffet lunches out. The first day was Chinese, and we brought along a good friend of my mom’s.

Chinese Buffet Lunch

Chinese Buffet Lunch

I also went with them (and 24 other residents of their building) to see the movie The Reader. I enjoyed the movie, even though it’s too long, and reasonably slow at times. Kate Winslet is an exceptional actress. It’s a very interesting character study, more so than a great story.

Lois worked (surprise, surprise) so she missed the movie. But, at night, she insisted that I tell her about it, in great detail. I did, finishing up the second half of the movie in the car the next day on our way north. I was amazed at the insights that she had, many of them pointing out flaws in the movie. I was unable to say “No, if you had seen it, you would have felt differently”, because she was right.

Either way, it was a very interesting experience, to see a movie, describe it in detail, and then discuss it as if we’d both seen it, and learn a number of things from the person who didn’t see it…

We spent most of Thursday in the car heading for Florence, SC. On Friday, we continued our trek home, with a detour off of I95 to Durham, NC, to meet up with our friend Wes (who joined us last time we visited David in Birmingham, but was unable to make it this time). We had a fantastic lunch at PF Chang’s with him.

Wes Hadar

Wes Hadar

From there, we headed for Richmond, where we spent the night at our friends house. It was the first night in three weeks not spent in a hotel bed. On Saturday morning, we had a great breakfast out with them (at Perly’s on Grace Street). We headed home directly from the restaurant (with a brief stop at the office in Fredericksburg along the way).

One amazing fact from this three week journey was the total lack of significant traffic the entire time. We drove from NY to Leesburg, to Fredericksburg, to Richmond, to Nashville, to Atlanta, to Birmingham, to South Florida, to Florence, to Durham, to Richmond, to Fredericksburg, to NY, with no long tie-up.

In fact, the only real traffic was 30 minutes from home, when we were delayed a total of nine minutes due to very heavy volume. Other than that, there were a few constructions areas, including lane closures, that forced us to slow down to 50MPH, which is nothing to complain about.

We’re back for two weeks, and then the driving begins anew…

Two Flew South

Send to Kindle

Lois asked me to name this post Two Flew South. She had a good reason, it was clever, so I didn’t hesitate in accepting her suggestion. Let’s not make it a habit though. This is my blog, not hers, and I intend to keep it that way. Of course, all of the photos are taken by her, so we’re partners in this, as we are in everything else in life. 🙂

Vacation is not a word that Lois or I use often. Even when we have a few days where we aren’t technically working, at least Lois (less so me), is working the Treo non-stop, and thinking about work issues non-stop as well. I’m better than she is at shutting that off, but I get sucked in, since I’m with her…

We’re on a two-week road trip at the moment, which is most definitely a vacation for me. Parts of it are even a vacation for Lois, though nowhere near the level that I am enjoying it. Since the road trip is mostly southbound, and there are two of us in the car, the title Two Flew South seems appropriate. It turns out it’s not the specific inspiration for the title (that’s coming later), but that’s why it was so easy to agree on.

The trip started nearly two weeks ago when we left NY and spent the day with our friends in Leesburg. We always have such a great time with them, even though seeing the dad suffer through his cancer treatments is heartbreaking. We then spent a week working at Zope.

Leesburg Friends

Leesburg Friends

We spent last weekend with our friends in Richmond, including a fantastic Super Bowl party at another friend’s house (10 of us enjoyed the game together). I was the only one rooting for the Steelers. That said, I really like Kurt Warner a lot, and wouldn’t have minded seeing him snag the victory. That made the last quarter all-the-more exciting, since the outcome was truly in doubt. A great game all around!

Richmond Friends

Richmond Friends

Super Bowl Party 1

Super Bowl Party 1

Super Bowl Party 2

Super Bowl Party 2

At 6:50am on Monday, we were on the road, officially on vacation (there’s that word again, I’m liking it a lot). 😉

We were headed straight for Nashville. On Ocotber 29th, 2008, we saw one of our many CMA Song Writer Series shows at Joe’s Pub. While the entire show was fantastic, we both were really blown away by Hillary Lindsey, and I highlighted that fact in a post the next day. Through that post, I ended up with an email relationship with a wonderful woman who lives and works in Nashville.

Through that email relationship, we had arranged to meet for dinner on Monday night. We had never even spoken on the phone, a true e-relationship. We asked her to select the restuarant. We met at 7pm at Tin Angel. We had the most wonderful evening. She’s a fascinating person and she picked an excellent restaurant (we all loved our meals). We ended up spending nearly three hours together, and we will definitely look her up the next time we’re in Nashville, and hope she does the same when she’s in NY!

New Nashville Friend

New Nashville Friend

The next day was carved out in advance to be spent with our good friend Jack Kapanka. It was freezing all over the south, Nashville included, so we decided in advance to see the sites from Jack’s car, rather than walk around the city. Jack picked us up at our hotel, and zigged and zagged all around Nashville, telling us about every building as we passed it. I loved every second of it!

We also took a long ride in the countryside, to and through Franklin, TN, gawking at mansion after mansion (they don’t call it Mansion Hill for nothing). We had lunch at a Pub in town (I should have written down the name, because we all really enjoyed our meals!). When we left, three men were approaching us (from quite a distance). Jack immediately recognized the middle man as James Otto. As we walked by them (they were headed to a Sushi restaurant for lunch) Lois casually said “Hi”, and James said hi back, so Lois can officially say that James Otto said hi to her. 😉

One Mansion

One Mansion

We then headed for Jack’s house, catching some incredible scenery along the way (including a bridge that isn’t obviously a bridge, until you’re on it, at which point everything around you is breathtakingly beautiful.

We had met Jack in person before, but this was the first time we were meeting his family. When we got to his house, his wife and toddler twins were there (the older girls were still in school). It’s hard to describe how/why you know you’ll be life-long friends with someone the instant you meet them, but there’s no doubt that this will be the case between us and Jack’s wife.

Jack's Wife

Jack's Wife

She’s an awesome person in her own right, on every level, but she might also be the best mom we’ve ever observed. That’s saying an awful lot, considering that our Richmond friends include a number of near-perfect moms (our godchildrens’ mom heading that list!). Lois can describe it better than I can, but no matter what’s going on around her, Jack’s wife exudes a strength and calmness, that nearly instantly tames all of those around her (her kids included!).

After meeting the older girls, and hanging for a bit, Jack and I took the oldest daughter and took a tour of their home town. Jack had been telling me for a while about another resident of the town, someone he had met in his church. He really wanted us to meet, so we stopped by his house. It took me all of 10 seconds to know how wonderful this man is, and why Jack likes him so much. We chatted for 20 minutes and then headed back to Jack’s house.

Jack and Older Daughters

Jack and Older Daughters

Shortly after getting back, we took two cars and headed to dinner with the entire family. We had an excellent meal at the Applebees right near our hotel. We said goodnight and were missing all of them by the time we were up in our room. Thanks for a wonderful day to all of the Kapankas! 🙂

Jack and Twins

Jack and Twins

The baby girl does fist bumps on cue!

Fist Bumping Baby

Fist Bumping Baby

On Wednesday morning, we worked in the room a bit, catching up on a ton of emails, then hit the road again. This time, our destination was Atlanta. We got there mid-afternoon, checked into the hotel, and did a bit more work.

At 5:30pm we headed over to a friend’s house. A number of our Atlanta friends also came over and we had an extraordinary home cooked meal. We brought wine from NY, and were really afraid (sure might be a better word) that it would spoil due to the extreme temperature swings throughout the trip (it was 19 degrees that morning in Nashville and Atlanta). Amazingly, the wine tasted yummy to me (and I hope our friends agreed).

Home Made Feast

Home Made Feast

Incredible Pie

Incredible Pie

The next morning we got together with a subset of the same folks we were with the night before for an incredible breakfast at Rise-N-Dine. It’s quite unusual to have an appetizer during breakfast, but we all split three Sweet Potato Pancakes as one. Wow. They were amazing, and I knew I would love my Polish Omelette as well (and I was correct!).

We said our sad goodbyes, lamenting that this wonderful whirlwind 18 hours was ending, and we hit the road for Birmingham to visit our godson. We settled into our hotel in Birmingham, and caught up with some more work. When David called to say he was on the way home from the hospital, we were thrilled to log off and head over to see him.

After catching up for a bit in his apartment, we headed for dinner at Jim ‘N Nicks BBQ. I didn’t realize it was a chain until I just looked it up. It’s a beautiful place. The service was excellent. All that is nice, but get to the food Hadar! Man, it was unbelievable. They start you off with homemade corn muffins that are infused with cheese (subtle, but delectable) that melt in your mouth.

Feeding the Meter

Feeding the Meter

David and I both had the Pulled Pork platter, and Lois had Smoked Chicken that she raved about. We capped it off with some Starbucks and headed back to David’s to cath up on Lost. We were two episodes behind, but David was happy to watch the one he had seen already again, and then he too got to watch the new one from the night before. We’re all caught up now, and anxiously awaiting the next few episodes. The excitement is back (it never left for me, but Lois is into this season more than last year’s).

Being a first-year resident, David is one rung above an indentured slave. Today is one of his all-too-regular 30-hour calls (he leaves early in the morning for the hospital, and doesn’t return until the following afternoon!). That meant we were on own own today. We headed to his apartment after breakfast and set up our computers for more catching up (he was long gone, and yes, it’s still a vacation). 😉

Just before lunch, we headed out for a shopping spree. Being godparents, we had a severe need to populate every empty space in David’s apartment with useful things (OK, so it was really more of Lois’ maternal instincts, but I was happy to play along). We bought a bunch of stuff at Bed Bath and Beyond. Then I dropped Lois at Costco and headed to have lunch by myself.

When we were last in Birmingham, we had another of our friends along with us, Wes. During that trip, both Wes and David told us that their favorite fast-food place is Chick-Fil-A. They couldn’t believe that I had never been in one. We had an aborted attempt to have lunch from there one day (my fault). After the trip, Wes sent us a Chick-Fil-A gift card (thanks again Wes!) to ensure that we made it our business to check it out.

Amazingly, in two consecutive trips to Zope, we were unable to schedule a visit to any of the Chick-Fil-A’s, including the one that is 1/4 of a mile from our hotel! I was determined to make it to one on this trip, and this seemed to be the most opportune time.

So, I drove 1/4 of a mile from Costco and ate a #1 meal in the place. It was excellent, so I now understand why many people rave about Chick-Fil-A (since Wes and David, at least five additional friends have told me that they consider it the best fast-food place). Considering that I still have a couple more meals left on the gift card, I will be thanking Wes again (and again). 🙂

I wandered into the Costco, and was surprised that I didn’t have too much trouble finding Lois, even though she was in the diagonally opposite corner from the main entrance (a very long walk!). She was just about done, so we both were impressed with the timing of my arrival. You would not believe how much stuff she bought. Of course, you might, given that I got to drive to Chick-Fil-A, eat a meal there, and get back, before she was done shopping. 🙂

When we got back, we experienced a few weeks worth of weight-lifting exercise. There is a very steep set of stairs outside of David’s apartment complex, then two more landings inside to get to his unit. We lugged all of the booty up over the course of four or five trips. Given how cold it had been on this trip, I had forgotten that sweating was possible. In addition to the manual labor, the weather broke today, and it was 60 degrees while we were unpacking.

While I am finishing this blog, Lois is on the phone with a Zope engineer, working away (is anyone surprised?). We will relax the rest of the evening (a little late night shopping is on the current agenda, but not for David this time). We can’t wait to see David again tomorrow afternoon (or more appropriately, after his obligatory nap!).

So, what’s left to say? Just the real explanation of the title of the blog.

In addition to listening to a ton of music (live and on the iPod), Lois also reads about music a lot. When something sounds like she would like it, she makes a note. A few times a year, she emails a list to me telling me that the time has come to place a large order. Lois really prefers physical CDs, largely for the liner notes, and I prefer downloads, both because they are cheaper (typically) and immediate (always).

One of the groups that she had on her list was One Flew South. I downloaded it a while ago, but for any number of reasons, we hadn’t listened to it (or most of the others on her most recent list). During this trip, Lois fired up One Flew South. Instant love. Lois thought there were nine voices (the harmonies are so rich), but it turns out that it’s only three guys.

Lois usually zones in on a handful of songs on a CD and she plays them over-and-over, to the exclusion of the others. This happened on this CD as well, and the ones that sang to her, have been listened to more than I would care to admit.

So, after hearing them for the umpteenth time, Lois said, “When you blog, please title it Two Flew South“, and it was so. 🙂

One more week to go on this road trip, and I intend to savor every single moment!

Converting from Procmail to Maildrop

Send to Kindle

I’ve been using procmail to filter mail on the server forever. I like it, so it’s important to note that even though I switched, I have nothing bad to say about procmail.

So, why did I switch? Procmail can be a little terse to read (obviously, I’m used to it by now). Over the years, I have built a large set of rules. There is a ton of cruft in there. If I wanted to clean it up, I had to rewrite it. Rewriting it in procmail was definitely a possibility.

But, over the years, I was also aware of maildrop as a filtering solution. It has a cleaner (more accurately, a more straightforward) syntax. The documentation is a little sparse (missing a few key examples IMHO). There are also thousands (if not millions!) of example lines of procmail available on the net, and it can be hard to find complex real-world examples of maildrop filters.

But, I knew that if I rebuilt my filters in maildrop, I’d be forced to rethink everything, since I couldn’t get lazy and just grab hunks of procmail from my current system and plop them into the new one. So, maildrop it was going to be!

One last time, just to make sure I don’t offend lovers of procmail (of which I am one!), everything that I did in maildrop could easily have been done in procmail. I just happened to choose maildrop for this rewrite, and for now, will stick with it. Perhaps if I ever revisit this project, I’ll iterate the next time back in procmail.

The goal of my filters is to toss obvious spam (send it to /dev/null). Likely spam gets sorted into one of three IMAP folders. The only reason I split it into multiple folders is so that I can test rules before turning them into full-blow deletes. Finally, mail that falls through those is delivered to my inbox.

Over the years, I added numerous rules to filter classes of spam (stocks, watches, viagra, insurance, etc.). Without a doubt, I introduced tons of redundancy. I didn’t scan all of the previous rules to see where I might be able to add one more line because it would be too tedious vs just adding a new rule.

I was reasonably satisfied with the result, but over time, became less aggressive about deleting mail automatically, preferring to stuff it in a spam folder for visual scanning during the day.

Since I create my own rules (I don’t run a system like SpamAssassin, which I did for a while), I can start to see patterns and simplifications over time, which was the impetus for the rewrite. In other words, there are more commonalities across classes of spam, and I don’t have to spend as much time categorizing things as I was bothering to do.

I’ve now made my first cut of the maildrop-based system. It’s been in production now for seven days, and I’m very happy with it so far. The one major change I made is to default to deleting things (in other words, much more aggressive than the previous system), but, I keep a copy of all mail in an archive IMAP folder that I will prune through a cron job, and never scan visually.

I review my delete logs once a day, so if I spot an email that looks like I shouldn’t have deleted it, or someone contacts me asking why I didn’t respond, I will be able to check the archive and have the full mail there (for some reasonable period of time).

Here’s the result of the rewrite:

The original procmail system had roughly 3800 lines it in (including comments and blank lines). The new maildrop system has under 550 lines, including comments and blanks. I delete more mail automatically, and in a week, haven’t deleted a single mail that I didn’t mean to. I am getting a few more emails sneaking into my inbox, but each day, I add a few more lines and the list gets shorter the next day.

Now that I am getting a bit more spam each day into my inbox, Thunderbird junk filters are getting more to train on, and they are getting better too, so even the junk that is getting in, is mostly getting filed in the Junk folder locally, automatically.

Here are two things that took me longer than they should have to figure out with maildrop (they are related, meaning the solution is identical in both cases, but it wasn’t obvious to me):

  • How to negate a test using !
  • How to use weighted scoring correctly (very simple in procmail)

Here’s a line in maildrop format:

if ($TESTVAR =~ /123/)

do something useful if true…

The above will “do something useful” if the variable TESTVAR contains the pattern 123. What if I want to “do something” if TESTVAR does not contain 123? Well, until I figured it out, I was making an empty block for “do something”, and adding an else for the thing I really wanted. Ugly.

My first attempt was to change the “=~” to “!~” (seemed obvious). Nope, syntax error. I then tried “if !($TESTVAR =~ /123/)”. Nope, syntax error. I then tried “if (!$TESTVAR =~ /123/)”. No syntax error, but it doesn’t do what I wanted.

I stumbled on the solution via trial and error:

if (!($TESTVAR =~ /123/))

Ugh. The ! can only be applied to an expression, which is normally (but not always?!?) enclosed in parens. But, the if itself requires an expression, so you need to put parens around the negated expression as well. At least I know now…

The second problem was weighted matches. I was having the same problem. Once I put parens around my expressions, it started working. That’s one of the few places where the procmail syntax feels a drop cleaner:




echo $COUNT

So, the above sets the variable COUNT to the number of times that the string 123 exists in the body of the message. That is then added to the number of times that the string 456 exists in the body, finally adding the number of times that the string 789 exists in the body. The total is then echoed to the console. Without the parens, no workie.

I don’t like the fact that I have to maintain the running count myself. In procmail, you basically set a limit and the tests stop once the limit is reached (which feels way more efficient). There might be a way to accomplish that with maildrop too, but I haven’t found it as yet…

While I fully expect to add more rules, or lines to existing rules, I can’t imagine a scenario where my file will even double from here, so it will end up at less than 1000 lines. That will be easier to maintain for a number of reasons, most notably syntax readability.