Update readme.md - this is all tested now

This commit is contained in:
Steven Polley 2020-10-30 00:19:51 +00:00
parent 81e35d46b8
commit e8ddc38159

View File

@ -1,12 +1,10 @@
# storage-security # 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. Security solution for my storage locker. Deployed to a raspberry pi with an attached camera.
##### The Background ##### 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 ### Technology Stack
@ -81,11 +79,7 @@ Finally, configure host access point daemon by creating the file named /etc/host
```conf ```conf
interface=wlan0 interface=wlan0
hw_mode=g hw_mode=g
ieee80211n=1
channel=7 channel=7
wmm_enabled=0
macaddr_acl=1
accept_mac_file=/etc/hostapd/accept
auth_algs=1 auth_algs=1
ignore_broadcast_ssid=0 ignore_broadcast_ssid=0
wpa=2 wpa=2
@ -132,51 +126,63 @@ Then setup the sync folder
sudo mkdir /sync 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. Setup syncthing to sync this folder with syncthing on my phone.
##### Build OpenCV and Application ##### 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 ```bash
cd ~ go get deadbeef.codes/steven/storage-security
git clone https://deadbeef.codes/steven/storage-security.git cd ~/go/src/deadbeef.codes/steven/storage-security
cd storage-security
go get go get
```
Build and install OpenCV:
```bash
cd ~/go/src/gocv.io/x/gocv cd ~/go/src/gocv.io/x/gocv
make install make install
```
Build and install storage-security:
```bash cd ~/go/src/deadbeef.codes/steven/storage-security
cd ~/storage-security
go build . go build .
sudo chmod +x storage-security
sudo chown root:root 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 ```s
[Unit] [Unit]
Description=storage-security Description=storage-security
[Service] [Service]
RunAs=pi
ExecStart=/usr/local/bin/storage-security ExecStart=/usr/local/bin/storage-security
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target
``` ```
And enable and start it And enable it, so it starts following a boot.
```bash ```bash
sudo systemctl enable storage-security.service sudo systemctl enable storage-security.service