Weighted DNSBLs with Postfix

For a really long time, I’ve been dreaming about the perfect mailserver setup. It would be almost perfect at telling spam from non-spam; it would include calendaring and a web GUI that actually looked good; it would be fast; it wouldn’t have issues sending mail to various ISPs…

My current — far from perfect — mailserver runs postfix-policyd, but the old version. It has a few features I love. I can easily set up spamtraps, for example, by just adding them to the relevant MySQL table. I have HELO-based restrictions: if you connect and say “HELO n1zyy.com” or “HELO 64.191.108.120” (my hostname or IP), your IP is blacklisted for a few days. If you email a spamtrap, your IP is blocked for a few days. It does greylisting, but I can do it per-mailbox — and even on the fly, it seems.

That’s not quite perfection, though. What I’ve really wanted for a long time is the ability to do weighted DNSBLs. Individually, trusting any DNSBL is bad. Even though most are reputable, if one person says you’re a spammer, that shouldn’t stop you. If multiple people say you’re a spammer, though, block away. Ideally, I’d be able to set per-list scores; if a conservative list says you’re a spammer, that counts a lot more than the lists that list whole netblocks.

policyd-weight turns out to be exactly what I want, and more. As the name implies, it computes a weight based on a variety of factors, looking at DNSBLs (and RHSBLs!) and also the HELO. I think I’m going to toy with this a bit, but it looks promising.

Tangentially, Atmail (@Mail) is the first webmail client I’ve ever seen that actually looks good. And it looks really good. It’s not only closed-source, though, it’s expensive. But it’s still tempting.

My Kind of Book

“In 1855, when Jose da Fonseca and Pedro Carolino wrote an English phrasebook for Portuguese students, they faced just one problem: they didn’t know any English. Even worse, they didn’t own an English-to-Portuguese dictionary. What they did have, though, was a Portuguese-to-French dictionary, and a French-to-English dictionary. The linguistic train wreck that ensued is a classic of unintentional humor, now revived in the first newly selected edition in a century.”

The original — well into the public domain by now — seems to be archived online, for those hesitant to pay for a book in broken English. (Or for those who love the typography in old books.)

Cops

I’ve always loved watching Cops. Tonight’s episode reminded of two things I’m quite certain about, though.

The first is that most criminals are astonishingly dumb. The first thing to happen in the show was a routine traffic stop that turned into a pursuit in which the driver crashed in the woods and fled until he was tackled. He stated that he ran because his license was suspended, which no one believed in the slightest. Highly suspicious, they searched his car, and happened to notice the interior of the passenger’s door was loose; they peeled it back and found a bunch of drugs, and he ended up with a long list of charges. It looked like a chance discovery, though — even when you run from the cops and they suspect there’s more going on than you tell them, I don’t think it’s routine for them to start ripping parts off your car in search of drugs. Had he stopped, the odds of anyone finding his drugs seem like they’d be slim — even if they decided they had cause to search the car, they probably wouldn’t have had a half-dozen officers all going through it, and the slightly-loose door panel may well have gone unnoticed.

As much as I love GTA, it really doesn’t make sense to me to run from the police, unless you’re in a stolen car and are an excellent driver. They’ve already called in your license plate long before you started to run. My experience is admittedly limited to that which I’ve seen on TV, but it seems that the vast majority of pursuits end up with a catastrophic crash and the driver being arrested. If you get away, odds are decent that you’re going to come home to a police car or two in your driveway.

The second thing I came to realize, though, is that the war on drugs is really out of control. I do think drugs are a problem and that people selling heroin to school children are evil. But there was a whole series of stings, in which undercover agents sold dime bags of cocaine to people. A half-dozen police cars would then converge and a dozen cops with guns drawn would pull the people out of their cars, throw them to the ground, and arrest them. They mentioned that they seized the cars of everyone involved. Every single person they showed being arrested looked like a well-dressed professional who was harmless and maybe even nice. Crack cocaine is terrible, I’m sure, but I can’t help but find the sheer brutality over something the size of a kernel of corn to be appalling. Besides being pulled from their cars at gunpoint and roughed up in the course of their arrest, these people had their cars seized (not impounded, but seized). I think I have pretty a pretty understanding employer, but I’m pretty sure that if I didn’t show up for work one day and explained a few days later that I’d been arrested for buying cocaine, I’d be fired. I can only imagine that many of these peoples had their lives ruined. (And if you’re now branded as a criminal, lost your job, and do drugs, what do you do? The answer, 95% of the time, appears to be, “Start selling drugs.”)

One more thing I’d like to call out, though, is the reason I gave for finding the “innocent-ish people buying $10 worth of cocaine” drug sting so objectionable. I said that they “looked like a well-dressed professional.” For me, that made them a little more like me and my peers. It’s not some random drugged-out lowlife; it’s people like me. (Well, minus the whole “buying cocaine” thing.) And on some level I’d defend myself here: it’s easier for me to see myself in these people. But on the other hand, something kind of scares me about my comments. This sort of treatment of people buying drugs has gone on for decades, but I didn’t really care until the people looked like me. When the people were homeless, badly-dressed, or of a different skin color, I never thought, “Wow, that’s really unreasonably brutal.” I should perhaps take solace in the fact that countless others think the same way as me, but, in actuality, that’s precisely what scares me so much.

Changing a Cookie’s Domain in Rails

This is one of those things that should be really easy, and that a lot of people probably already know… But in the hopes of saving someone 30 minutes of frustrated searching, here’s what you should know.

If you want to change your session cookie’s path globally, there’s a documented setting. But what if you want to set some one-off cookie to be from something other than your FQDN?

It’s actually simple: rather than setting the cookie to a string (with its value), you use a hash:
cookies[:logged_in_username] = {
value => "jdoe123", :domain => ".example.com" }

It’s typical to just do cookies[:logged_in_username] = “jdoe123”, but it does accept a hash. (:expires is available, too.)

It turns out this is documented exactly where it should be, but that page doesn’t seem to get much love from Google.

FYI: root@notty

I assume most people know this, but for the benefit of those who get paged at 4am and are maybe not at their mental prime, here it goes:

If you see “sshd: root@notty” in your process list and find yourself wondering what box “notty” is and assuming you’ve been hacked and it’s some malicious connection to some mysterious box named “notty”… Relax. “notty” isn’t a mysterious hostname. In keeping with all the other “sshd: root@pts/1” sort of entries you might see, it’s the TTY the connection is on, not the hostname. Or, in this case, it’s no TTY, because it’s something like scp, not an interactive session.

Progress

One thing that boggles my mind sometimes is that there are people living who witnessed racial discrimination as codified in the nation’s laws. Crazier still, when I say that “there are people living” who remember a time when the law actually required racial discrimination in many places, I’m not referring to a handful of octogenarians who grew up with horse-drawn carriages. I’m talking about people in their 40s. That’s insane to me, largely because it defies belief that a nation founded on the premise of all men being created equal would have been so shortsighted as to pass laws doing nothing but promoting hate and prejudice. I could kind of understand if it was in 1850 or something, but it was still happening in the 1960s, and was still a giant controversy a mere decade before my birth.

So it brings a smile to my face to realize that odds are pretty good that in a decade or two, I’m going to be telling people about a time when the country had laws against gay people. People are going to look at me like I’m full of crap when I tell them that we wouldn’t even let gays serve in the military, even when comparatively backwards nations did. (Russia permits “well-adjusted” homosexuals to serve, for example. What that means, or how it’s not terribly offensive, escapes me.) I’ll tell people that freedom-loving Americans  — and churches which also taught about God’s love for everyone — protested allowing homosexuals the same rights as heterosexuals, and people will think I’m nuts.

Way Down the Line

I was on Facebook and happened to see something from a really old friend, going back to elementary/middle school. Being fried after 12 hours of work, I poked around and looked at their friends, and found a lot of people I haven’t so much as remembered the existence of for close to a decade. And after looking at the people I knew, I looked at the people they knew, and found more people I knew.

There were a few little things I found interesting. A lot of people who were in my peer cohort are now married. That freaks me out. A lot of people I know from back then joined the military, too. Not a single person I’ve talked to in the past decade is in the military, so the discrepancy is interesting. Politics also interest me. People who had similar childhoods to me and who grew up in the same socioeconomic status as me developed wildly interesting political opinions. Some are Glenn Beck fans, some are hippies who blame Bush for 9/11. It’s interesting that having so much in common, people can still arrive at such varied political leanings.

But what really spurred me to write this isn’t the changes… It’s what hasn’t changed. With zero exceptions thus far, everyone is basically how I remember them. The people that I thought were good students now have successful careers. The people that I thought were total burnouts/losers in my youth are still that way. The people who were friendly, easygoing people have pics of them smiling with friends; the people who weren’t nice have photos of them shooting guns or looking mean.

On some level, I think this is neat. My childhood opinions of people from more than a decade ago turned out to be accurate predictors of them after college. But at the same time, this is horrifying to me. Based on superficial opinions of how studious a second-grader is, I can predict with astonishing accuracy whether they’re going to go to college, graduate at the top of their class, and land a great job, or if they’re going to become potheads with a minimum wage job. Surely, though, a person’s post-college career isn’t predestined before they turn 10, and certainly, someone can change a lot between the time they’re learning the alphabet and the time they’re studying calculus. But no one really has.

Why is this? Does it become a self-fulfilling prophecy, where those who aren’t good students in elementary school just assume they’re bad students and don’t try to advance themselves? Is it a simple question of class? And how important are the first few years of elementary school — was that just a manifestation of something else, or would forcing your 3rd grader to be an A-student mean they landed an awesome job? Surely, you’re not powerless if you have a 3rd grader who’s a bad student? It really boggles my mind that there could be such a strong correlation?

Boxee But Good

When I moved into my apartment, my roommate and I came to the realization that neither of us valued cable television at more than a few dollars a month. I have a nice television, and I do put it to good use, just not via cable. I live in the suburbs of Boston, so I get a few of the local stations in crisp HD. (Actually, living in the suburbs of Boston is really the perfect place: most of the antennas for the local stations are in the same suburbs.)

But really, watching live TV is so old-fashioned. The odds of there being something good on TV at the same time I want to watch TV are pretty slim, from what I’ve seen. And with just a few channels, it means that I watch live TV pretty rarely. Instead, I use my computer. Hulu is nothing new, and I just signed up for Netflix, not to rent DVDs but to stream movies and TV shows over the Internet. With a DVI-to-HDMI converter, I can make my TV a full-HD “monitor” for my computer and play things there.

I’ve recently become hooked on something much cooler, though: Boxee. It’s a free (GPL) app that runs on all major operating systems and transforms them into a pretty awesome Home Theater PC. You can watch a lot of streaming TV shows from major providers like Hulu and several of the networks. If you have media saved to your computer (or other computers on your network!) you can use to play content, too. It does music and movies, and even a photo browser. And there’s an App Library with sundry apps for things like Pandora, Netflix, TED Talks, and the White House. It’s free, and it’s an easy install. (At least on Mac. I assume Windows is easy. Linux is great if you’re running a recent version of Ubuntu and don’t use ATI video cards… Grr.)

Boxee Home Screen

The Home screen allows you to navigate all the major areas, and shows a “feed” of new content, some featured videos, and anything you’ve got in your queue. It’s a full-screen app, so you have things like a clock and the local weather, too, which is really kind of neat. (You can change the background image… It looks great full-screen, but kind of creepy and dirty in a thumbnail.)

Boxee Beta TV Show ListingWith the new Boxee Beta release, you can search by name, without having to care where the video is from. It’ll search all its sources for shows and allow you to pick which source you want to use.

Boxee Beta Music ListingBoxee does music, too. It automatically detected my iTunes Library and will play it. (As a side-note, this list isn’t at all representative of my musical tastes.)

Pandora App on Boxee BetaOne of the standard apps is a Pandora client. It’s not terribly evident at the moment the screenshot was taken, but it does some visualizations if you let it run. (Here, it’s on the David Guetta “channel” I listen to at work; I also have a Yo-Yo Ma channel that may be more appropriate for background music from a media center. Rank a couple songs there and soon it’s nothing but great instrumentals.)

Boxee Beta Photo BrowserThere’s a built-in photo browser, too. I didn’t test it with network photos (or even my real photo library), but I believe it’ll support network media just as well as local media, which is kind of neat. (PS – I’m not a giant creep, despite what the photos in the library may imply. I was creating a test account called “Da Bomb,” and needed to test photo upload functionality… I don’t normally stockpile photos of bombs and things being blown up, but I figured a screenshot of family photos would be weird to post, too.)

My one real complaint isn’t Boxee’s fault at all: there’s not a lot of good content available. Many studios are reluctant to post anything online. Hulu is by far the best, but there’s bad blood between Hulu and Boxee, with many studios demanding that Hulu not permit set-top clients, but Boxee managing to embed the browser inside Boxee. The episodes available online aren’t always the most recent, and there’s rarely a full selection. I did pair it with my $9/month Netflix collection to expand my options, though: suddenly, I can choose from thousands of movies and a handful of TV shows, and start watching in less time than it’d take me to dig the DVD off a shelf and load it into a DVD player.

Overall, though, Boxee gets an A+ in my book. It’s really a pretty amazing product, and it’s free.

But what I really want is the Boxee Box, an HTPC dedicated to running Boxee. (It happens to look amazing, too.) It won’t be available until later this year, sadly. Rumors put it at a mere $200; if that’s accurate, I’m ordering one the day they become available. I love Boxee on my laptop, but having a dedicated device would be so much better. In the meantime, sign up and download Boxee for your computer. You’ll thank me later.

The iPad

Apple’s tablet was rumored to exist months, if not a year, before it was announced. There’s probably at least a decade of tradition involved — people have always talked about an Apple tablet. The media coverage of this rumored device was so over-the-top that one reporter called the reporting “fan fiction,” and a few tech sites started calling it the “Jesus Tablet.”

The problem for Apple is that there was so much hype and speculation that their product, in many peoples’ eyes, didn’t live up to the rumors. One reporter called it an “oversized iPod Touch” to explain why they were disappointed by it. And indeed, it was disappointing. Among the rumored features: background app support (so you could have one application running in the background while using another, and switching effortlessly between them), a video camera with video chat support, and, long overdue, the ability to display Flash applets on things. None were implemented.

But despite being a little bit of a letdown, I still want one. I’m not going to run out and impulse-buy one for $500, but it’s certainly earned a spot on my gadget wish-list. I know a lot of people who have said they don’t see the point. But here’s what I see in it.

I have a B&N Nook. It’s pretty amazing. I have lots of PDFs and a few books on it. When taking the train in, I sometimes purchase a copy of the LA Times or New York Times for 75 cents on the Nook, and get the day’s news. (Boston Globe: I’d totally buy your paper instead, if only you offered it on the Nook.) But current e-readers have some shortcomings. For one, as beautiful as the e-ink screen is, it’s a pain to use. I brought my Nook into work and a few coworkers were trying it out. They all did the same thing I keep instinctively trying: they touched the e-ink screen to select things, and swiped their finger across the screen to advance to the next page. And waiting 1-2 seconds for the screen to redraw is infuriating if you’re into what you’re reading, or if you’re a fast reader. This isn’t a Nook shortcoming, as much as a shortcoming of e-book readers as a whole.

I also find I want a web browser. The Kindle has one, though I’m told it’s a bit persnickety and not all a “real” browser like modern smartphones have. (i.e., the pages don’t look anything like you’d see on a normal computer.) I have my iPhone for browsing, though when I’m holding a much bigger screen, it’s kind of annoying to have to have to switch to the iPhone’s seemingly-tiny screen to browse the web.

For non-geeky computer users, I think the iPad could even replace a conventional computer. A lot of people don’t do much beyond checking email and browsing the web. If the iPad weren’t hamstrung by not being able to do Flash, that alone might make it worthwhile for some people. Add in support for iPhone apps, stellar mapping, an impressive photo browser, the ability to play music and movies, and the ability to read e-books, and it’s really a pretty nifty device.

The iPad could be better, and it is a bit disappointing compared to the rumors. But I still think it’s a pretty useful device.