diff --git a/README.md b/README.md index ff4bfd4..59830f1 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,10 @@ # storage-security -NOTE: All of this is untested, I don't yet have hardware - just planning ahead. - Security solution for my storage locker. Deployed to a raspberry pi with an attached camera. ##### The Background -In mid-October 2020, my storage unit was broken into. This is going to be my method of collecting evidence and hopefully to identify the intruder. I'm also just trying to have fun with what is overall a bad situation for me. The major constraint for this project is it must be low power and there is no persistent communication channel to allow streaming video off premises (risk is intruder may discover and remove the storage device from the premises). Using some clever tricks, I may be able to mitigate this risk 90% of the time by keeping a phone hidden in my parked vehicle which syncs log and video data when my vehicle is parked in my parking stall? +In mid-October 2020, my storage unit was broken into. This is going to be my method of collecting evidence and hopefully to identify the intruder. I'm also just trying to have fun with what is overall a bad situation for me. The major constraint for this project is it must be low power and there is no persistent communication channel to allow streaming video off premises (risk is intruder may discover and remove the storage device from the premises). Using some clever tricks, I may be able to mitigate this risk 90% of the time by keeping a phone hidden in my parked vehicle which syncs log and video data when my vehicle is parked in my parking stall? If it's possible to communicate up to my unit in some way, I could trigger some form of alarm in my unit when motion is detected in my storage area. ### Technology Stack @@ -81,11 +79,7 @@ Finally, configure host access point daemon by creating the file named /etc/host ```conf interface=wlan0 hw_mode=g -ieee80211n=1 channel=7 -wmm_enabled=0 -macaddr_acl=1 -accept_mac_file=/etc/hostapd/accept auth_algs=1 ignore_broadcast_ssid=0 wpa=2 @@ -132,51 +126,63 @@ Then setup the sync folder sudo mkdir /sync ``` +Create the systemd unit file at /etc/systemd/system/syncthing.service + +```s +[Unit] +Description=syncthing + +[Service] +RunAs=pi +ExecStart=/usr/bin/syncthing + +[Install] +WantedBy=multi-user.target +``` + +And enable it, so it starts following a boot. + +```bash +sudo systemctl enable syncthing.service +sudo systemctl start syncthing.service +``` + Setup syncthing to sync this folder with syncthing on my phone. ##### Build OpenCV and Application -Now that the infrastructure is set up the last thing needed is the application itself. The RPI will run hot and may crash if cooling is not provided. This stage will take up to an hour. Clone this repository onto the rpi and +Now that the infrastructure is set up the last thing needed is the application itself. The RPI will run hot while building and may crash if at minimum passive cooling is not provided. This stage may take up to an hour. Clone this repository (right here, the one you're reading) onto the rpi and grab all the go packages with go get. ```bash -cd ~ -git clone https://deadbeef.codes/steven/storage-security.git -cd storage-security +go get deadbeef.codes/steven/storage-security +cd ~/go/src/deadbeef.codes/steven/storage-security go get -``` - -Build and install OpenCV: - -```bash cd ~/go/src/gocv.io/x/gocv make install -``` -Build and install storage-security: -```bash -cd ~/storage-security +cd ~/go/src/deadbeef.codes/steven/storage-security go build . -sudo chmod +x storage-security sudo chown root:root storage-security -mv storage-security /usr/local/bin +sudo mv storage-security /usr/local/bin ``` -Create the systemd file at /etc/systemd/system/storage-security.service +Create a systemd service unit file at /etc/systemd/system/storage-security.service ```s [Unit] Description=storage-security [Service] +RunAs=pi ExecStart=/usr/local/bin/storage-security [Install] WantedBy=multi-user.target ``` -And enable and start it +And enable it, so it starts following a boot. ```bash sudo systemctl enable storage-security.service