mirror of
https://github.com/novatiq/packages.git
synced 2026-04-30 15:38:40 +01:00
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:
@@ -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}'"
|
||||
|
||||
Reference in New Issue
Block a user