Track your (Synology) NAS when it’s stolen

When a friend of mine recently got his MacBook stolen, I quickly verified if I had installed Prey Project on each laptop/desktop PC I have. For those who do not know Prey:

Prey lets you keep track of your phone or laptop at all times, and will help you find it if it ever gets lost or stolen. It’s lightweight, open source software, and free for anyone to use. And it just works.

Yes, I had Prey running on each PC. And then I looked at my Synology NAS (DS410, 4 disks, 8TB raw storage). It could be stolen too. And it’s basically a Linux box. And Prey is available for Linux …

So I figured out how to install Prey on a Synology box:

  1. login via ssh as root
  2. install the ipkg/’Bootstrap’ module on your NAS server – (from forum.synology.com) and this is a list of the right bootstraps for the right Synology model.
  3. install bash shell – “ipkg install bash” (from forum.synology.com)
  4. install textutils – “ipkg install textutils” (from forum.synology.com)
  5. goto /usr/share and download the latest Linux version of Prey (wget http://preyproject.com/releases/...linux.zip ) and unzip it
  6. create an account on Prey and get your API key from your Account profile.
  7. create a new device (e.g. ‘NAS8TB (Syn410)’), indicate OS as Debian (it’s close enough) and get the device key.
  8. edit the /usr/share/prey/config file and fill in the API and device key
    # you can get both of these from Prey's web service
    api_key='yyyyyyyyyy'
    device_key='xxxxxx'
  9. now run the “bash /usr/share/prey/prey.sh” a first time – you should get a “-- Got status code 200! -- Nothing to worry about. :) -- Cleaning up!” response.
  10. now edit /etc/crontab and add a line
    5-55/20 * * * * root /opt/bin/bash /usr/share/prey/prey.sh >  /usr/share/prey/lastrun.log
  11. Now restart crontab in the following (non-standard-Linux) way (from forum.synology.com):
    /usr/syno/etc.defaults/rc.d/S04crond.sh stop
    /usr/syno/etc.defaults/rc.d/S04crond.sh start
  12. And it’s running! When your Synology is stolen, you set its status in your Prey account to ‘Missing’ and you will start getting email reports every 20 minutes. Because it’s a NAS, there is no webcam and no screenshots can be taken, but the external IP address will let you see where the device turns up.
    Remote IP: 78.29.245.xxx
    Private IP: 192.168.0.108
    Gateway IP: 192.168.0.1
    MAC Address: xx:xx:xx:xx:xx:xx

Would this work on a QNAP server? I’m guessing, yes.

Tagged on: , ,

One thought on “Track your (Synology) NAS when it’s stolen

  1. Wim

    How ironic, I just got my MacBook stolen recently.
    As its predecessor got stolen only six months ago, I had installed Prey on this one.

    Two weeks after my macbook got stolen, I got my first email from my now ex-laptop. And lo and behold, the geo locating script even gave me a location.
    Alas! My beloved laptop had found a new home near Casablanca, Morocco… 🙁 Not soon after I had solid information about who the new owner was, and where exactly he lived.
    I gave all the information to the authorities, but I have no expectations of ever seeing that machine again 🙁
    The worst part is that I now still get emails every five minutes and know way more about the new owner than I’d like to, but I’m not able to stop the Prey scripts from sending me these things! 🙂 So on my current laptop, after installing Prey, I modified the scripts so that they establish a ssh connection to a server I manage on the internet, with a reverse tunnel.
    That way I will still be able to login to it, and if I’m getting tired of following the now life of my old hardware, I can at least disable the recurring task in cron. 🙂

    That being said, it’s a great piece of software, and the fact that it only relies on bash to work makes it extra-portable. I just got unlucky that my laptop found its way out of the country so fast. Had it been booted up earlier, still inside the country, I might actually have been able to catch the thief and recover my machine.
    So I strongly urge every one to look into this! 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *