Linux
Turn programs on and off with Bluetooth in Ubuntu
Having recently been messing around with ZoneMinder for home security, I wanted to turn on and off the program using Bluetooth. Basically, the idea being that when I am around, the server will sense my presence (no Darth Vadar jokes please
) via the Bluetooth on my phone and turn off ZoneMinder. Then, if I leave the location of the server, it will no longer be able to sense Bluetooth on my phone and thus will turn on ZoneMinder.
So, I hunted around for such a program, I came across bluemon and BlueProximity, but they both only worked on proximity, i.e. they relied on you being near by, as far as I could tell, there was no option of running an action when the phone was completely unavailable.
So, I decided to write my own script to do what I wanted. Now, bear in mind I have very little skill when it comes to Bash and scripting and what I wrote was a result of trial and error. It all revolves around a tool called hcitool that can be used in Linux to control Bluetooth connections.
The first attempt at my script can be found here and with another link below.
It is only designed to work with ZoneMinder and there isn’t much advice within the code, but I shall update it as time goes by to make it more useful
Here is the full link to the script:
The Quest For Security
So, I have been pretty quiet of late, sorry about that. Well, the main reason was it was Xmas a while back, but also, I have been doing LOADS of research into security on the web.
For the past few months I have been toying with the idea of implementing a security device on my network that would take all the leg work of antivirus and intrusion detection and prevention off each PC on the network and get a dedicated machine to do it.
It turns out there are lots of options out there to do this, so I dabbled with a few.
The first I checked out was http://www.untangle.com/. Untanlge basically is a special Debian distro with lots of preconfigured security tools, like ClamAV for antivirus, snort_inline for intrusion prevention and iptables for a firewall. It comes with a very easy to use web interface making it idiot proof. However, I came across a few problems. First, it needs a PC with two NICS to be used as a dedicted server, something I didn’t have. Second, you can use it on a Windows XP machine, but it installing a Virutal Machine via VMPlayer, it then automagicaly reconfigures your network so that all traffic is routed through it first. However, this also wasn’t a great solution since it means you need to have a machine effectively running to OSs at once (Windows XP and the Virtual Machine) and also it did not work with my Vista lappie. Finally, it also prevented me from browsing gmail, so it was a no go for me – although some fix to do with Socks5 was the cure.
Second, I tried rolling my own system using snort_inline (http://snort-inline.sourceforge.net/), ClamAV, iptables and Ubuntu. This is what has taken me an age. I have never built any app from source before and it took me a long time to figure out what to do. Plus, I wanted to run this on a low power box and the only one I had available that had two NICS was an old thin client that runs of a USB 2.0 harddrive, so it aint that fast at all. However, I have finally managed got snort_inline running, with a ClamAV preprocessor and logging to mySQL. So far it is only scanning all the traffic coming into my network, I haven’t yet got it to actually prevent anything yet.
I finally tried out an interesting solution http://packetprotector.org/. This is kinda like the untangle solution, except that it all runs off your router. Sadly, all the routers it currently runs off are pretty hard to get hold of here in the UK, but from what I see, it might be the best solution. You get an advanced iptables firewall, snort_inline, dansguardian (content filtering) and ClamAV all running on top of OpenWRT. The only negative I can see is you need to be a bit of a linux guru to know what you are doing if you want to start to customise it (though it does come with the WebIF interface) and that it can bog down pretty quickly. However, to me it seems the best solution, until I get some super powerful server that I can run untangle, or monowall or IPcop or EasyIDS on. There are loads of solutions out there, you just need the right old PC to run it on, or a PC that you think is going to be quiet enough
Linux commands to be aware of
Just came across this excellent little article about some dangerous commands that the less than chivalrous Linux user might give out to Linix noobies, for a joke. The only problem is, these jokes will kill your hard drive and/or PC. Not cool.
The NSLU2 is awesome
I have already mentioned Linksys’ NSLU2 in a previous post and I thought I should go in some more detail about this great little product. As mentioned, it is a Network Attached Storage (NAS) device, allowing you to attach two USB hard drives to it, so they can be accessible on your network. The standard firmware also allows you to run an FTP server off it and carry out backups to and from the device.
However, it really comes into its own when you install some custom firmware on it, available from here and here. This site gives access to a variety of firmware, from one based on the original Linksys firmware (probobly the easiest to use, but based on an old Linux kernel) called uNSLUng to full blown Debian.
This opens up a whole world of possibilities, as you can then install loads of apps to the little device, and since most of these firmware types allow you run the firmware from an attached drive, you then get past the limited memory of the device. You can visit here to find out what people are doing with their NSLU2s, commonly called slugs. Examples include using it to host Apache2 and WordPress (as I did to run my website for my wedding), run an iTunes mt-daap server called firefly, run various backup solutions and even as the basis for a Digital Photo Frame.
Personally, I installed openWRT on it, as it is designed to be run from memory (so the hard drive aint running all the time) and it has a nice web interface. I use it to run a number of rsync jobs, as described in a previous post, to back up my media files occasionally, so it acts as a redundant drive. I might also get it to act as an FTP server and I am considering installing the IDP program snort on it. It wont be a Gatekeeper but it will be a start. There is a huge amount you can do with this device and it is great to use for task that need a computer to be on all the time, but doesn’t require much processing power. Since the slug uses very little power when running, it will save on your electricity bills
