OpenWRT CCTV project

To improve surveillance I bought another Y-cam Knight S as the Bullet HD was too rich for me at ~400GBP, and I figured if my upload is only 0.3 Mb/s, was there any point since HD images will probably be much bigger! I did look at other IP cameras, and since the camera module for the Raspberry PI seemed nowhere near ready and huge lead times, I opted for the devil I knew.

TP-Link TL-WR1043ND with a USB key used as an OpenWRT overlay

Since the Y-cam's Knights are unable to sanely upload via HTTP leaving me with FTP, I "hacked" my OpenWRT 10.03.1 flashed TP-Link TL-WR1043ND to become an intermediary upload hub. I added a USB key and a FTPd, rsync etc and this took 2 days of life for this.

First day went down to a botched upgrade. OpenWRT 10.03 to 10.03.1 did not go well with LuCI going bust /etc/config/luci seems to be corrupt. I got it going again by relying on the failsafe mode and reset button.

After re-installing 10.03.1, I wasted a lot of time on getting the ext4 overlay working because I failed to specify ext4.

Once the /dev/sda1 USB stick overlay was on, I had 8G of breathing space! Wow. I installed syslog-ng3 to get it logging nicely to papertrail. The logs are helpful, but not the same as logread annoyingly.

OpenWRT pumping out to Papertrail

Installing pure-ftpd was a little bit of a pain because /etc/config/pure-ftpd wasn't enabled and I almost went down a out of date OpenWRT docs rathole with puredb:/etc/pureftpd.pdb. option authentication 'unix' is fine!

I bothered creating a ycam user in /etc/passwd but I could have easier configured my Y-cams to simply upload as root.

Then I replaced dropbear with openssh and friends like ssh-keygen. I created a key for a new ycam user on one of my servers. Now to configure rsync like so:

if ! flock -n /var/lock/sync-cctv.lck -c "rsync -a --remove-source-files /home/ycam/ ycam@remote-server:"
	logger already syncing

I'm a bit wary of using --remove-source-files since the files might be still being written by pure-ftpd. I tried it a few times and it seems to work.

I also don't quite understand flock. It works, but why leave the lock file around once finished? I don't quite understand how flock takes a lock and I should have fleshed this lock out in bash.

Getting the cron in openwrt 10.03.1 working was a bit of PITA since logread is the only way to see output and it always gives it under a misleading cron.err title. I found */5 * * * * sh /root/ works for me.

On the server where the motion detected images are uploaded, I deployed software I call Praze with a slightly different way to sort the images and of course a user/pass. See the demo.

Issues left:

Need to play around with Trigger settings on the Y-cam


If you like this, you might like the stateless Web kiosk software I develop. Webconverger typically replaces Windows on PCs and is deployed in public and business environments for ease of deployment and privacy. Once installed it auto-updates making it painless to maintain. Try it where you exclusively use the only viable open platform... the Web!