travelmate: update 2.0.2

* fix a vpn/iptables race condition
* remove needless dnsmasq dependency
* synchronize code-base of all auto-login scripts, due to
  COVID-19 restrictions all of them are still untested/WIP
* various small cleanups

Signed-off-by: Dirk Brenken <dev@brenken.org>
This commit is contained in:
Dirk Brenken
2020-10-03 10:24:28 +02:00
parent d3a213b01b
commit 404dc5b101
11 changed files with 159 additions and 96 deletions
+12 -5
View File
@@ -8,10 +8,15 @@
# Please note: you have to setup the package 'wireguard' or 'openvpn' before using this script
LC_ALL=C
PATH="/usr/sbin:/usr/bin:/sbin:/bin"
export LC_ALL=C
export PATH="/usr/sbin:/usr/bin:/sbin:/bin"
set -o pipefail
if [ "$(uci_get 2>/dev/null; printf "%u" "${?}")" = "127" ]
then
. "/lib/functions.sh"
fi
. "/lib/functions.sh"
vpn_action="${1}"
trm_vpnservice="$(uci_get travelmate global trm_vpnservice)"
trm_vpniface="$(uci_get travelmate global trm_vpniface)"
@@ -60,7 +65,8 @@ then
vpn_status="$(ubus -S call network.interface."${trm_vpniface}" status 2>/dev/null | jsonfilter -l1 -e '@.up')"
if [ "${vpn_action}" = "disable" ] && [ "${vpn_status}" = "true" ]
then
if [ -n "$("${trm_iptables}" "-w $((trm_maxwait/6))" -C ${trm_iptrule_drop} 2>&1)" ]
if [ -n "$("${trm_iptables}" "-w $((trm_maxwait/6))" -C ${trm_iptrule_drop} 2>&1)" ] && \
[ -n "$("${trm_iptables}" "-w $((trm_maxwait/6))" -C ${trm_iptrule_accept} 2>&1)" ]
then
"${trm_iptables}" "-w $((trm_maxwait/6))" -I ${trm_iptrule_drop} 2>&1
f_log "info" "lan forward blocked for device '${trm_landevice}'"
@@ -68,7 +74,8 @@ then
fi
if [ "${vpn_action}" = "disable" ] && [ "${status%% (net cp *}" = "connected" ]
then
if [ -n "$("${trm_iptables}" "-w $((trm_maxwait/6))" -C ${trm_iptrule_accept} 2>&1)" ]
if [ -n "$("${trm_iptables}" "-w $((trm_maxwait/6))" -C ${trm_iptrule_accept} 2>&1)" ] && \
[ -z "$("${trm_iptables}" "-w $((trm_maxwait/6))" -C ${trm_iptrule_drop} 2>&1)" ]
then
"${trm_iptables}" "-w $((trm_maxwait/6))" -I ${trm_iptrule_accept} 2>&1
f_log "info" "lan forward on ports 80/443 freed for device '${trm_landevice}'"