Merge branch 'master' of code.ungleich.ch:ungleich-public/ungleich-tools into master
This commit is contained in:
commit
fe52cd53bd
8 changed files with 195 additions and 6 deletions
|
@ -20,6 +20,27 @@ fi
|
|||
cat <<EOF | ssh -t "root@${openwrt_ip}"
|
||||
set -x
|
||||
|
||||
opkg update
|
||||
opkg install mjpg-streamer kmod-video-uvc
|
||||
|
||||
uci set mjpg-streamer.core.enabled=1
|
||||
uci set mjpg-streamer.core.resolution="1920x1080"
|
||||
uci delete mjpg-streamer.core.username
|
||||
uci delete mjpg-streamer.core.password
|
||||
uci commit
|
||||
|
||||
/etc/init.d/mjpg-streamer restart
|
||||
|
||||
EOF
|
||||
|
||||
exit 0
|
||||
|
||||
|
||||
# This is old code / when we used motion
|
||||
|
||||
cat <<EOF | ssh -t "root@${openwrt_ip}"
|
||||
set -x
|
||||
|
||||
opkg update
|
||||
opkg install motion kmod-video-uvc
|
||||
|
||||
|
|
30
openwrt-add-gps.sh
Normal file → Executable file
30
openwrt-add-gps.sh
Normal file → Executable file
|
@ -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 <<EOF | ssh -t "root@${openwrt_ip}"
|
||||
set -x
|
||||
|
||||
opkg update
|
||||
opkg install kmod-usb-acm gpsd
|
||||
|
||||
uci set gpsd.core.enabled=1
|
||||
uci set gpsd.core.listen_globally=1
|
||||
uci set gpsd.core.device="/dev/ttyACM0"
|
||||
uci commit
|
||||
|
||||
EOF
|
||||
|
|
44
openwrt-add-qmi-lte.sh
Executable file
44
openwrt-add-qmi-lte.sh
Executable file
|
@ -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 <<EOF | ssh -t "root@${my_ip}"
|
||||
set -x
|
||||
|
||||
# update the sources & allow https handling
|
||||
opkg update
|
||||
opkg install libustream-openssl ca-bundle ca-certificates
|
||||
|
||||
# Install needed kernel module
|
||||
opkg install kmod-usb-net-qmi-wwan uqmi luci-proto-qmi
|
||||
|
||||
# opkg install usb-modeswitch kmod-mii kmod-usb-net kmod-usb-wdm kmod-usb-net-qmi-wwan uqmi
|
||||
|
||||
# Create interface
|
||||
# uci set network.LTE=interface
|
||||
# uci set network.LTE.ifname='${interface}'
|
||||
# uci set network.LTE.proto='dhcp'
|
||||
|
||||
# add to correct firewall zone
|
||||
# current_networks=\$(uci get firewall.@zone[1].network)
|
||||
|
||||
# if ! echo \$current_networks | grep -q LTE; then
|
||||
# uci set firewall.@zone[1].network='\${current_networks} LTE'
|
||||
# fi
|
||||
|
||||
# commit
|
||||
uci commit
|
||||
|
||||
# reboot
|
||||
|
||||
reboot
|
||||
|
||||
EOF
|
0
openwrt-add-temper.sh
Normal file → Executable file
0
openwrt-add-temper.sh
Normal file → Executable file
63
openwrt-add-wireguard.sh
Executable file
63
openwrt-add-wireguard.sh
Executable file
|
@ -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 <<EOF | ssh -t "root@${my_ip}"
|
||||
set -x
|
||||
|
||||
opkg update
|
||||
|
||||
opkg install wireguard luci-app-wireguard
|
||||
|
||||
# VPN / Wireguard
|
||||
uci set network.wg0=interface
|
||||
uci set network.wg0.proto='wireguard'
|
||||
uci set network.wg0.private_key='${private_key}'
|
||||
uci set network.wg0.listen_port='51820'
|
||||
uci set network.wg0.addresses='${my_wireguard_ip}/64'
|
||||
|
||||
if ! uci get network.@wireguard_wg0[0]; then
|
||||
uci add network wireguard_wg0
|
||||
fi
|
||||
|
||||
uci set network.@wireguard_wg0[0]=wireguard_wg0
|
||||
uci set network.@wireguard_wg0[0].persistent_keepalive='25'
|
||||
uci set network.@wireguard_wg0[0].public_key='${vpn_endpoint_pubkey}'
|
||||
uci set network.@wireguard_wg0[0].description='IPv6VPN.ch by ungleich'
|
||||
uci set network.@wireguard_wg0[0].allowed_ips='::/0'
|
||||
uci set network.@wireguard_wg0[0].endpoint_host='${vpn_endpoint_host}'
|
||||
uci set network.@wireguard_wg0[0].endpoint_port='51820'
|
||||
uci set network.@wireguard_wg0[0].route_allowed_ips='1'
|
||||
|
||||
# commit
|
||||
uci commit
|
||||
reboot
|
||||
|
||||
EOF
|
21
openwrt-hp-250-g5-add-wifi.sh
Executable file
21
openwrt-hp-250-g5-add-wifi.sh
Executable file
|
@ -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 <<EOF | ssh -t "root@${openwrt_ip}"
|
||||
opkg update
|
||||
opkg install kmod-iwlwifi iwlwifi-firmware-iwl7265d wpa-supplicant
|
||||
EOF
|
|
@ -52,12 +52,26 @@ 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
|
||||
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
|
||||
|
|
Loading…
Reference in a new issue