From 659066f8981e0ae262950e5e2a7e5222ad5ea80b Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 4 Nov 2020 10:55:48 +0100 Subject: [PATCH 1/8] [viirb] viirb3: less verbose cdist run --- viirb-3-configure-vpnendpoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/viirb-3-configure-vpnendpoint.sh b/viirb-3-configure-vpnendpoint.sh index ac3b742..77d64f4 100755 --- a/viirb-3-configure-vpnendpoint.sh +++ b/viirb-3-configure-vpnendpoint.sh @@ -52,7 +52,7 @@ git commit -m "[vpn] Updated config for peer ${viirb_hostname} ${my_network}" git pull git push -cdist config -vv -j8 ${vpn_endpoint_host} -c ${dot_cdist} +cdist config -v -j8 ${vpn_endpoint_host} -c ${dot_cdist} # Test that the VPN connection is established # Might take longer due to reboot From c86635ed56995345eb6e1d4adb62ea79a67a17ff Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 4 Nov 2020 10:57:44 +0100 Subject: [PATCH 2/8] [viirb] viirb3: stop if successful ping --- viirb-3-configure-vpnendpoint.sh | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/viirb-3-configure-vpnendpoint.sh b/viirb-3-configure-vpnendpoint.sh index 77d64f4..8387449 100755 --- a/viirb-3-configure-vpnendpoint.sh +++ b/viirb-3-configure-vpnendpoint.sh @@ -58,6 +58,20 @@ cdist config -v -j8 ${vpn_endpoint_host} -c ${dot_cdist} # Might take longer due to reboot sleep 10 -ping -c10 ${my_wireguard_ip} -ping -c10 ${my_lan_ip} -ping -c90 ${my_wifi_ip} +i=0 +while [ $i -lt 10 ]; do + ping -c1 ${my_wireguard_ip} && break + i=$((i+1)) +done + +i=0 +while [ $i -lt 10 ]; do + ping -c1 ${my_lan_ip} && break + i=$((i+1)) +done + +i=0 +while [ $i -lt 10 ]; do + ping -c1 ${my_wifi_ip} && break + i=$((i+1)) +done From 5945e87f0f031602a6fb5eed3937401a01e6e90e Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 4 Nov 2020 14:36:05 +0100 Subject: [PATCH 3/8] [openwrt] add script to enable wifi on hp notebooks --- openwrt-add-gps.sh | 0 openwrt-add-temper.sh | 0 openwrt-hp-250-g5-add-wifi.sh | 21 +++++++++++++++++++++ 3 files changed, 21 insertions(+) mode change 100644 => 100755 openwrt-add-gps.sh mode change 100644 => 100755 openwrt-add-temper.sh create mode 100755 openwrt-hp-250-g5-add-wifi.sh diff --git a/openwrt-add-gps.sh b/openwrt-add-gps.sh old mode 100644 new mode 100755 diff --git a/openwrt-add-temper.sh b/openwrt-add-temper.sh old mode 100644 new mode 100755 diff --git a/openwrt-hp-250-g5-add-wifi.sh b/openwrt-hp-250-g5-add-wifi.sh new file mode 100755 index 0000000..adb58fb --- /dev/null +++ b/openwrt-hp-250-g5-add-wifi.sh @@ -0,0 +1,21 @@ +#!/bin/sh + +if [ $# -lt 1 ]; then + echo "$0 ip-address" + echo " ip-address: where to find the device" + exit 1 +fi + + +openwrt_ip=$1; shift + +ping -c3 ${openwrt_ip} +if [ $? -ne 0 ]; then + echo "Cannot reach ${openwrt_ip}, aborting" + exit 1 +fi + +cat < Date: Wed, 4 Nov 2020 14:39:32 +0100 Subject: [PATCH 4/8] also add wpa-supplicant for wpa2 support --- openwrt-hp-250-g5-add-wifi.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openwrt-hp-250-g5-add-wifi.sh b/openwrt-hp-250-g5-add-wifi.sh index adb58fb..cc26bbc 100755 --- a/openwrt-hp-250-g5-add-wifi.sh +++ b/openwrt-hp-250-g5-add-wifi.sh @@ -17,5 +17,5 @@ fi cat < Date: Thu, 19 Nov 2020 19:49:00 +0100 Subject: [PATCH 5/8] [openwrt] add script to only configure the wireguard vpn --- openwrt-add-wireguard.sh | 63 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100755 openwrt-add-wireguard.sh diff --git a/openwrt-add-wireguard.sh b/openwrt-add-wireguard.sh new file mode 100755 index 0000000..d44d9e9 --- /dev/null +++ b/openwrt-add-wireguard.sh @@ -0,0 +1,63 @@ +#!/bin/sh +# Nico Schottelius +# 2020-11-19 + +if [ $# -lt 4 ]; then + echo "$0 ip-address vpn-server ipv6-network [privatekey]" + echo " ip-address: where to find the OpenWRT device" + echo " vpn-server: where to connect to" + echo " vpn-server-pubkey: public key of the server" + echo " ipv6-network: which network to use for us (/48 expected)" + echo " private-key: specify wireguard key optionally" + exit 1 +fi + +my_ip=$1; shift +vpn_endpoint_host=$1; shift +vpn_endpoint_pubkey=$1; shift +network=$1; shift + +# wireguard +if [ $# -eq 1 ]; then + private_key=$1; shift +else + private_key=$(wg genkey) +fi + +my_prefix=$(echo $network | sed 's,::/.*,,') +my_wireguard_ip=${my_prefix}::42 + +public_key=$(echo $private_key | wg pubkey) + +cat < Date: Thu, 19 Nov 2020 19:49:24 +0100 Subject: [PATCH 6/8] [openwrt] camera switch to mjpg --- openwrt-add-camera.sh | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/openwrt-add-camera.sh b/openwrt-add-camera.sh index 33d5fd3..25d98a8 100755 --- a/openwrt-add-camera.sh +++ b/openwrt-add-camera.sh @@ -20,6 +20,27 @@ fi cat < Date: Thu, 19 Nov 2020 19:49:40 +0100 Subject: [PATCH 7/8] [openwrt] initial gps code --- openwrt-add-gps.sh | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/openwrt-add-gps.sh b/openwrt-add-gps.sh index 772e1e8..ae65aa5 100755 --- a/openwrt-add-gps.sh +++ b/openwrt-add-gps.sh @@ -1,5 +1,31 @@ #!/bin/sh -opkg install kmod-usb-acm +if [ $# -lt 1 ]; then + echo "$0 ip-address" + echo " ip-address: where to find the device" + exit 1 +fi -# ugps? + +set -x + +openwrt_ip=$1; shift + +ping -c3 ${openwrt_ip} +if [ $? -ne 0 ]; then + echo "Cannot reach ${openwrt_ip}, aborting" + exit 1 +fi + +cat < Date: Mon, 30 Nov 2020 10:34:53 +0100 Subject: [PATCH 8/8] ++lte/openwrt Signed-off-by: Nico Schottelius --- openwrt-add-qmi-lte.sh | 44 ++++++++++++++++++++ openwrt-add-lte.sh => openwrt-add-usb-lte.sh | 0 2 files changed, 44 insertions(+) create mode 100755 openwrt-add-qmi-lte.sh rename openwrt-add-lte.sh => openwrt-add-usb-lte.sh (100%) diff --git a/openwrt-add-qmi-lte.sh b/openwrt-add-qmi-lte.sh new file mode 100755 index 0000000..0f4caae --- /dev/null +++ b/openwrt-add-qmi-lte.sh @@ -0,0 +1,44 @@ +#!/bin/sh +# Based on work of Samuel Hailu, 2020-09-10 + +if [ $# -ne 1 ]; then + echo "$0 ip-address interface" + echo " ip-address: where to find the OpenWRT device" + exit 1 +fi + +my_ip=$1; shift +interface=$1; shift + +cat <