26 Jul 2014 SSH through a Raspberry Pi Railway Signal
We’ve all been there. You are in the supermarket with two bottles of diet cola in one arm and a packet of brown rice with quinoa in the other. Your site lead calls you with a request from a client who has locked themselves out of their account. Normally you would direct them to the administration interface but, because of the paradox inducing way in which they have bent the fabric of space and time, this will require some manual intervention. You need to apply some subtle but distinct database changes. Simply delete a row or two from the QUANTUM_PARADOX table. Well, it’s actually a view… but that’s not important right now.
It’s not because of the Coke and it’s certainly not because of the quinoa, but you reluctantly tell your site lead that he’ll probably have to handle this one himself. Having recently spilt Champaign on your MacBook Air (don’t ask), you have sent this off to Apple to be laughed at by a specialist. “There is quite a lot of liquid on the airport card”, they said. That’s not liquid. That’s a bottle of Tasmanian Jansz. “Lingering flavours of citrus and nougat will make a toast with this an experience that lasts.” Perhaps they were right about that. Either way, pouring Champers onto your primary computing device had a slightly different effect than the one in Electric Dreams.
Staggering off the tram and through your front door you realise that you probably could have this production issue covered. No need for your giant novelty sized Mac at the office. No need for your MacBook Air that succumbed to an episode of Offspring and half a glass of delightful Australian wine.
You’ll likely have an iPad mini with a Bluetooth keyboard and a copy of iSSH. Pop these on the kitchen counter, place the quinoa gently to one side, crack your knuckles and get to work.
ERMAHGERD. It seems iSSH, in a way similar to standard OS X, doesn’t support the cipher suite required to connect to the production Ubuntu EC2 instances. If only there was some kind of way to have this SSH session connect via a different, more capable SSH session. You know, like in some kind of utopian future with flying cars and compulsory spandex.
Ask yourself, what would MacGyver do? This is where you’ll be glad you built that Raspberry Pi powered railway signal with a base 100 Ethernet connection to Cable Internet. I had always liked having some kind of local infrastructure running in the house. I know it’s all about the Clouds these days but who can’t spare a few milliamps of power for an embedded device? Forget a desktop machine. Power hungry, noisy, and the looks I got from my girlfriend with a mini-tower sitting in the middle of the dining room table. Well, I assume she was looking at me with scorn. My view of her was mostly obstructed by a 27-inch monitor.
Over the years I had experimented with repurposing the Nintendo Wii, an ADSL Router (killing the administration application on a D-Link will free up megabytes of RAM) and this one time, a smoke detector. I’m still determined to compile Linux into 64 bytes of programmable ROM.
Last year I had built a Twitter enabled Lavatory using a Raspberry Pi and a Bluetooth mouse. Let’s just say the Internet community was agasp to its socio-technological implications, not to mention the privacy concerns. It has since been decommissioned.
Whilst trawling eBay for smaller, hand held roadworks and railway lanterns I came across a decommissioned three-light railway signal. Weighing a svelte 30 kilograms, this towering hunk of iron and coloured glass sits in the corner of my living room. I could clearly see the scornful looks of my girlfriend on this occasion. Being a bit of a hacker herself (and the one who introduced me to the Raspberry Pi in the first place), she was quite impressed when I, as one says, pimped that light.
The Raspberry Pi is a cheap, ARM based, credit card sized single board computer, which boots from an SD card. It was designed by the Raspberry Pi foundation in the UK for use as an educational tool for kids all other the world. Connectors include HDMI, Ethernet, USB and General Purpose IO pins for the especially nerdy. The Pi runs a bunch of different operating systems but the core OS would have to be Raspbian. It’s a version of Debian Linux preinstalled with all the goodies you need to get up and running. Whilst there is an OpenJDK version of Java available, Oracle have developed a special version of their JVM with quite a snappy Just In Time compiler.
The Pi Model B, with 512 Meg of RAM and sporting a 700 Mhz processor will happily run Apache Tomcat. With my recent work on Silicone, an open-source “Single Page Controller” (that’s code for yet another web framework), I had the idea to combine all these into a little project I call Pimp My Light. A relay board connected to the GPIO switches on and off the three coloured lights (low wattage LED down-lights). Visiting will serve a simple, single page application from Tomcat running on the Pi installed inside the light itself. You can click on the lights and change them in real time. Every now and again it will feel the need to tweet what it’s up to. It’s open-source as well, if you wanted to build something similar or just check out how it’s done.
Sorry. While I was rambling about the Pi, the client is becoming more distressed about their locked account. As I was saying, simply jump your iPad mini’s iSSH connection though your local crowd sourced illumination server. Log into the Pi and from there, log into to the EC2 server that will happily communicate with it. There are no flying cars and the spandex is gaining momentum, but the future is now. Having the Pi running nearby helped me out when I was in a bind. Without putting too fine a point on it, everything is connected. The fact that I was invited to share this story with you reminds me of how life is what happens while we are busy making other devices.
The end game? QUANTUM_PARADOX table updated with 3 rows affected (until observed). Happy client. And its a bit like hacking in a Discotheque. Win win. And don’t forget the quinoa.