Streaming Music From Home to Work

People at work have noticed that I am able to stream my music collection on a server at home to my desktop at work. Here’s the short hack that does the streaming… it’s just two php files and a css file:

  • browse.php – lets you browse through directories
  • stream.php – starts a stream with mime-type audio/mpegurl
  • streamer.css – a little CSS for small readable fonts

menosan

I have about ~75Gb of mp3s that I have accumulated through the years (ironically, I actually have about 5 boxes of CDs in the attic to support the legality of my collection). The mp3s are stored on a Debian Linux server in the basement. I manage the mp3s using Apple’s iTunes from my Windows laptop connected to the file server via Samba. I have Apache and PHP on the Linux box as well. From work, I just hit a URL with my browser, click ‘stream’ and listen using Windows Media Player. If you look at the code, you’ll notice that it performs character set conversions from CP850 (which is how the files are stored on the Samba server) to ISO-8859-1 (which is what makes all the diacritic chars display properly).

Works well enough for me. I tried Jinzora once. It looks great, but I couldn’t get it to work for some reason. Maybe you will have better luck.

M3rry Chr1stm4s, y0u ar3 0wn3d

Had a bit of a scare last night. I was logged in to one of my Debian Linux servers just making a short configuration change to something when, for no apparent reason, I ran chkrootkit (checks for the presence of rootkits… a positive result indicates that the host has been broken in to), which came back with output like this:

Checking `asp’… not infected
imdur
Checking `bindshell’… not infected
Checking `lkm’… You have 3 process hidden for readdir command
You have 3 process hidden for ps command
Warning: Possible LKM Trojan installed

Checking `rexedcs’… not found

Um, ok. That’s not good. That’s also entirely unexpected, since I am vigilant about handling security related issues. I ran chkrootkit again, almost in disbelief. It returned no such warning this time.

About this time, I started thinking about Murphy. Christmas Eve. Family in town. Big dinners. Presents. Relaxing. Server possibly compromised. Spending endless hours in a datacenter hunched over a keyboard while my skin slowly goes dry. Headaches and tense shoulders. Why now, why me???

I sat on the sofa in shock for about 10 minutes.

But it doesn’t make sense. I pulled down the latest version of chkrootkit and started going through the source code. What I realised is that the part that the lkm tests are actually using pretty simple code. What’s happening is that chkrootkit (which is a shell script) uses chkproc to see if there are entries in the /proc filesystem that do not exist in the process table.

But there’s a not-so-subtle race condition that can easily arise, especially on a server that creates lots of processes. Between the time that chkproc can parse and store the output of ‘ps’ and start the process of comparing it to the entries in /proc, new processes can be created. Since the original ps entries are cached, the new process will falsely trigger an alert.

LKM compromises are the hardest to detect and fix. I wasn’t looking forward to handling that. But it seems like all is well and I can now reproduce this problem to my satisfaction.

Now Christmas can indeed be Merry…

Your Email works… Your Email Works… Your Email Works…

One interesting side effect of having highly accurate anti-spam filters is that I am frequently wondering if there is a problem with mail delivery on my servers. I’m flipping over to my inbox more and more only to discover that there are no new messages. The constant stream of spam also served as a nagging re-assurance that things were indeed working. Without this, how do I know if my filters are operating superbly or if the mail partition is full? weight gain cardizem

Or maybe my main contacts are just using AIM and IRC for everything…?

Whirlycache 0.6.5 Released

Whirlycache 0.6.5 is now available. Whirlycache is an extremely fast in-memory Java object cache.

New features for this release include:

  • Cocoon integration from Peter Royal (BETA): you can how use Whirlycache as a Store in Cocoon
  • Hibernate integration (BETA): You can now use Whirlycache as a Hibernate cache provider
  • A new Cacheable interface allows cached objects to hook in to lifecycle methods to provide customized functionality when store(), retrieve() and remove() events occur.

Get the 0.6.5 release at: http://whirlycache.dev.java.net/

Eclipse Goodie

I’m using this little Eclipse goodie every day since I discovered it earlier in the week. It’s a common occurrence that you have a java.util.Collection object reference and want to iterate over it. Check this out:

Eclipse auto-complete for iteration

In Eclipse, after the object ref was assigned to list, I hit ctrl-space and found a wonderful addition to the menu (iterate over collection) that sets up my code with a for() loop and populates everything for me.

Try it. You’ll use it all the time.

Love/Hate/qmail

I’ve been a qmail convert since I worked for pate in 1999 when it truly was the best option out there insofar as MTAs were concerned. Maybe it still is. I wish the licensing terms were compatible with the terms that my preferred distribution for Linux-based servers uses.

Qmail, for those of you who don’t know, is a mail server. It receives emails, usually from the network, and processes them by delivering them locally or passing them on to their ultimate destination on a remote host. It’s fast, secure and very stable. Almost no maintenance is required.

These days, however, you need more than just something to process mail: you usually need a virus scanner, anti-spam facilities, some kind of user database that doesn’t require system accounts, integration with IMAP and POP3 servers, support for mailing lists, TLS, SMTP-Auth, and flexibility at every corner for your own customizations.

But it strikes me that at the end of 2004, these needs ought to be commoditized such that a reasonably competent sysadmin can simply install all of the above using their distribution’s package manager. This shouldn’t be hard.

Instead, due to the Qmail license, the process requires a certain level of expertise, patience and time. Download qmail, vpopmail, courier, the netqmail patches, vqadmin, qmailadmin, qmail-scanner, ClamAV, and SpamAssassin. Verify compatibility between all of the above, usually by reading the notes buried in qmail source patches, docs and mailing lists for all of the above. Oh, and qmail.org is probably one of the most user-unfriendly websites in the world. They claim:

online zimulti

It’s not designed to be easy to use — it’s designed to be comprehensive.

… as if the two were mutually exclusive.

By any measure, the complexity and effort involved is a pain in the neck. And I don’t believe that it provides any real benefit over simply installing prebuilt binary packages.

Your other option is to go and find prebuilt packages made by someone who is in the position you are in. I’ve been down that road before and had to abandon that approach when I needed some kind of special patch to the qmail source.

I have to give a special nod to the traditional UNIX mentality here: do one thing and do it well. That’s what all of the aforementioned packages do. They each represent a best-in-class solution to a specific problem. Integrating them is the trick. It certainly is possible, but it seems like it could be a whole lot easier. I like modularity and loose coupling, but I wish the pieces fit together a little easier. One thing that would help in this regard is license-compatibility. If the qmail license was a traditional open-source licence, someone could customize it to integrate with various sundry components and turn out a click-and-run email server.

In spite of all the trouble that one must endure while putting together a setup like this, once it is running, it tends to stay running without intervention. If there is another integrated open-source stack that people use for email, I haven’t found it yet.

Sorry, I Don't Speak Texan

Apparently, the Associated Press writers were up a little late last night… they must have been a bit slap-happy today when they wrote this article that appeared on CNN:

Before church, the president, clad in a tan cowboy hat, moseyed around the Rose Garden area, his dog, Barney, in tow.

Moseying. Clad. Tan cowboy hat. Towing a dog before church. It’s an impressive sentence, don’t you think?. I wonder how often George puts his cowboy hat on (“Lau-ra! Where’s my tan 10-gallon?”) before dawdling in the Rose Garden with Barney? It is an event that must be all the more awkward with three secret service agents in tow as well, as if they’re guarding some kind of important event that must imperatively take place.