SSH Tip: Hash known_hosts names

I picked up a little book called SSH Mastery the other day. It’s a fairly short read, but quite interesting.

It mentioned one tip that happened to solve something that always bothered me—ssh keeps a ~/.ssh/known_hosts file with the host keys of all the machines you’ve connected to previously. It’s good for SSH, since it can verify that the host keys haven’t changed since you last connected, but it’s also a privacy and security risk, to have a file listing all the servers you have access to. Not exactly something that keeps me up at night, but a sub-optimal situation.

The book mentions that ssh can easily be changed to record a hash of the hostnames instead, with the directive HashKnownHosts yes. (But note that it’s not retroactive, though ssh-keygen has an option to encode the existing ones.)

The only downside is that this makes it impossible to periodically prune the contents of known_hosts of systems you no longer care about — though that probably won’t save you more than a few kB of disk space.

Purging Old Mail in Thunderbird

I’ve always wished for a feature in a mail client that would let me say, “Only keep mail in this folder for ___ days,” after which point it would just be automatically deleted. I filter mail from mailing lists into individual folders, and mail can get out of control quickly if I don’t watch it. I’ve searched a few times for Thunderbird extensions to do this, and was always surprised that none existed. In the back of my mind, I figured I’d have to write my own.

Today, I realized why this plugin doesn’t exist. It’s because it’s a native feature in Thunderbird.

Right-click on a folder, click “Properties,” and then there’s the “Retention Policy” tab:

Oh happy day.