From: rtrimana Date: Fri, 16 Jun 2017 18:55:59 +0000 (-0700) Subject: Adding more setup files for device registration, more scripts, and hostapd-psk list... X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=aaeb8fd547d4d8cfa423d6032d07a9931e3a830d;p=lede.git Adding more setup files for device registration, more scripts, and hostapd-psk list of devices --- diff --git a/sentinel_setup/config/dhcp b/sentinel_setup/config/dhcp index acba5d9167..ddd0548ae5 100644 --- a/sentinel_setup/config/dhcp +++ b/sentinel_setup/config/dhcp @@ -34,3 +34,63 @@ config odhcpd 'odhcpd' option leasefile '/tmp/hosts/odhcpd' option leasetrigger '/usr/sbin/odhcpd-update' +# RaspberryPi4 +config host + option ip '192.168.1.192' + option mac '74:da:38:0d:05:56' + +# RaspberryPi2 +config host + option ip '192.168.1.191' + option mac '74:da:38:0d:05:55' + +# RaspberryPi1 +config host + option ip '192.168.1.108' + option mac '74:da:38:68:72:8a' + +# Android Phone +config host + option ip '192.168.1.50' + option mac '64:bc:0c:43:3f:40' + +# Amcrest Camera 1 +config host + option ip '192.168.1.195' + option mac '3c:ef:8c:7f:c0:19' + +# Amcrest Camera 2 +config host + option ip '192.168.1.196' + option mac '3c:ef:8c:6f:79:5a' + +# iHome Speaker 1 +config host + option ip '192.168.1.119' + option mac 'c8:d5:fe:e6:ad:96' + +# iHome Speaker 2 +config host + option ip '192.168.1.234' + option mac 'c8:d5:fe:e6:a2:d8' + +# ESP board +config host + option ip '192.168.1.222' + option mac '18:fe:34:db:59:72' + +# Lifx light bulb 1 +config host + option ip '192.168.1.126' + option mac 'd0:73:d5:12:8e:30' + +# Lifx light bulb 2 +config host + option ip '192.168.1.232' + option mac 'd0:73:d5:02:41:da' + +# WeMo +config host + option ip '192.168.1.145' + option mac '94:10:3e:36:60:09' + diff --git a/sentinel_setup/config/hostapd-psk b/sentinel_setup/config/hostapd-psk new file mode 100644 index 0000000000..18a3b9d94c --- /dev/null +++ b/sentinel_setup/config/hostapd-psk @@ -0,0 +1,12 @@ +74:da:38:0d:05:56 1qaz2wsx3edcPi4 +74:da:38:0d:05:55 1qaz2wsx3edcPi2 +74:da:38:68:72:8a 1qaz2wsx3edcPi1 +64:bc:0c:43:3f:40 1qaz2wsx3edcPhone +3c:ef:8c:7f:c0:19 1qaz2wsx3edcCam1 +3c:ef:8c:6f:79:5a 1qaz2wsx3edcCam2 +c8:d5:fe:e6:ad:96 1qaz2wsx3edcSpk1 +c8:d5:fe:e6:a2:d8 1qaz2wsx3edcSpk2 +18:fe:34:db:59:72 1qaz2wsx3edcEsp +d0:73:d5:12:8e:30 1qaz2wsx3edcLight1 +d0:73:d5:02:41:da 1qaz2wsx3edcLight2 +94:10:3e:36:60:09 1qaz2wsx3edc diff --git a/sentinel_setup/config/wireless b/sentinel_setup/config/wireless index d4a09ead20..15199a0047 100644 --- a/sentinel_setup/config/wireless +++ b/sentinel_setup/config/wireless @@ -14,6 +14,7 @@ config wifi-iface 'default_radio0' option ssid 'LEDE' option encryption 'psk2' option key '1qaz2wsx3edc' + option wpa_psk_file '/etc/config/hostapd-psk' option isolate '1' config wifi-device 'radio1' @@ -31,4 +32,5 @@ config wifi-iface 'default_radio1' option ssid 'LEDE' option encryption 'psk2' option key '1qaz2wsx3edc' + option wpa_psk_file '/etc/config/hostapd-psk' option isolate '1' diff --git a/sentinel_setup/register/README b/sentinel_setup/register/README new file mode 100644 index 0000000000..129e2f3eb9 --- /dev/null +++ b/sentinel_setup/register/README @@ -0,0 +1,19 @@ +Device registration utility for Sentinel system +This is a simple script that register a new device +into /etc/config/dhcp and /etc/hostapd-psk +Copyright (c) 2015-2017, Rahmadi Trimananda PLRG@UCIrvine + +Usage: + ./register_device.sh [-h] + ./register_device.sh [-a ] + ./register_device.sh [-l] + +Options: + -h show this usage + -a adding device by putting MAC address, desired IP address, key, and device name (optional) + -l show list of devices registered + + +Notes: +- This simple script now only adds device information (no delete feature) +- Meant to ease the setup process (mimicking production environment) diff --git a/sentinel_setup/register/devices.dat b/sentinel_setup/register/devices.dat new file mode 100644 index 0000000000..ffea2e2ce0 --- /dev/null +++ b/sentinel_setup/register/devices.dat @@ -0,0 +1,2 @@ +12:32:34:45:56:67 192.168.2.123 mydevice +12:32:34:45:56:67 192.168.2.123 mydevice diff --git a/sentinel_setup/register/register_device.sh b/sentinel_setup/register/register_device.sh new file mode 100755 index 0000000000..193381bd33 --- /dev/null +++ b/sentinel_setup/register/register_device.sh @@ -0,0 +1,62 @@ +#!/bin/sh + +# Print usage +if [ "$#" -eq 0 ] || [ "$1" == "-h" ]; then + echo "Device registration utility for Sentinel system" + echo "This is a simple script that register a new device" + echo "into /etc/config/dhcp and /etc/hostapd-psk" + echo "Copyright (c) 2015-2017, Rahmadi Trimananda PLRG@UCIrvine" + echo "" + echo "Usage:" + echo " ./register_device.sh [-h]" + echo " ./register_device.sh [-a ]" + echo " ./register_device.sh [-l]" + echo "" + echo "Options:" + echo " -h show this usage" + echo " -a adding device by putting MAC address, desired IP address, key, and device name (optional)" + echo " -l show list of devices registered" + echo "" + +elif [ "$1" == "-a" ]; then + + if [ "$2" == "" ] || [ "$3" == "" ] || [ "$4" == "" ]; then + echo "Empty or incomplete parameters! Please run ./register_device.sh -h for usage." + else + # Add a new device + MAC=$2 + IP=$3 + KEY=$4 + + # Keep a local log + echo "$MAC $IP $KEY $5" >> devices.dat + + # Insert into /etc/hostapd-psk + echo "$MAC $KEY" >> /etc/hostapd-psk + + # Insert into /etc/config/dhcp + echo "" >> /etc/config/dhcp + if [ "$5" != "" ]; then # If device-name is not empty + echo "# $5" >> /etc/config/dhcp + fi + echo "config host" >> /etc/config/dhcp + echo " option ip '$IP'" >> /etc/config/dhcp + echo " option mac '$MAC'" >> /etc/config/dhcp + + if [ "$5" != "" ]; then # If device-name is not empty + echo " option name '$5'" >> /etc/config/dhcp + fi + echo "Device added!" + fi + +elif [ "$1" == "-l" ]; then + # Print list of devices + echo "List of devices" + cat devices.dat + echo "" + echo "/etc/hostapd-psk" + cat /etc/hostapd-psk +else + echo "Unknown option. Please run ./register_device.sh -h for usage." +fi + diff --git a/sentinel_setup/setup/dhcp b/sentinel_setup/setup/dhcp new file mode 100755 index 0000000000..28632484c9 --- /dev/null +++ b/sentinel_setup/setup/dhcp @@ -0,0 +1 @@ +cat /tmp/dhcp.leases