|
|
@ -30,7 +30,7 @@ proto_openfortivpn_setup() { |
|
|
|
|
|
|
|
local msg ifname ip server_ips pwfile callfile |
|
|
|
|
|
|
|
local host peeraddr port tunlink local_ip username password trusted_cert \ |
|
|
|
local peeraddr port tunlink local_ip username password trusted_cert \ |
|
|
|
remote_status_check |
|
|
|
json_get_vars host peeraddr port tunlink local_ip username password trusted_cert \ |
|
|
|
remote_status_check |
|
|
@ -41,7 +41,7 @@ proto_openfortivpn_setup() { |
|
|
|
[ -n "$tunlink" ] && { |
|
|
|
network_get_device iface_device_name "$tunlink" |
|
|
|
network_is_up "$tunlink" || { |
|
|
|
msg="$tunlink is not up $iface_device_up" |
|
|
|
msg="$tunlink is not up $iface_device_name" |
|
|
|
logger -t "openfortivpn" "$config: $msg" |
|
|
|
proto_notify_error "$config" "$msg" |
|
|
|
proto_block_restart "$config" |
|
|
@ -52,8 +52,7 @@ proto_openfortivpn_setup() { |
|
|
|
if echo "$peeraddr" | grep -q -E "$IPv4_REGEX"; then |
|
|
|
server_ips="$peeraddr" |
|
|
|
elif command -v resolveip >/dev/null ; then |
|
|
|
server_ips="$(resolveip -4 -t 10 "$peeraddr")" |
|
|
|
[ $? -eq 0 ] || { |
|
|
|
server_ips="$(resolveip -4 -t 10 "$peeraddr")" || { |
|
|
|
msg="$config: failed to resolve server ip for $peeraddr" |
|
|
|
logger -t "openfortivpn" "$msg" |
|
|
|
sleep 10 |
|
|
@ -67,7 +66,7 @@ proto_openfortivpn_setup() { |
|
|
|
|
|
|
|
|
|
|
|
[ "$remote_status_check" = "curl" ] && { |
|
|
|
curl -k --head -s --connect-timeout 10 ${tunlink:+--interface} $iface_device_name https://$peeraddr > /dev/null || { |
|
|
|
curl -k --head -s --connect-timeout 10 ${tunlink:+--interface} "$iface_device_name" "https://$peeraddr" > /dev/null || { |
|
|
|
msg="failed to reach https://$peeraddr${tunlink:+ on $iface_device_name}" |
|
|
|
logger -t "openfortivpn" "$config: $msg" |
|
|
|
sleep 10 |
|
|
@ -77,7 +76,7 @@ proto_openfortivpn_setup() { |
|
|
|
} |
|
|
|
} |
|
|
|
[ "$remote_status_check" = "ping" ] && { |
|
|
|
ping ${tunlink:+-I} $iface_device_name -c 1 -w 10 $peeraddr > /dev/null 2>&1 || { |
|
|
|
ping ${tunlink:+-I} "$iface_device_name" -c 1 -w 10 "$peeraddr" > /dev/null 2>&1 || { |
|
|
|
msg="$config: failed to ping $peeraddr on $iface_device_name" |
|
|
|
logger -t "openfortvpn" "$config: $msg" |
|
|
|
sleep 10 |
|
|
@ -96,7 +95,7 @@ proto_openfortivpn_setup() { |
|
|
|
|
|
|
|
# uclient-fetch cannot bind to interface, so perform check after adding host dependency |
|
|
|
[ "$remote_status_check" = "fetch" ] && { |
|
|
|
uclient-fetch --no-check-certificate -q -s --timeout=10 https://$peeraddr > /dev/null 2>&1 || { |
|
|
|
uclient-fetch --no-check-certificate -q -s --timeout=10 "https://$peeraddr" > /dev/null 2>&1 || { |
|
|
|
msg="$config: failed to reach ${server_ip:-$peeraddr} on $iface_device_name" |
|
|
|
logger -t "openfortvpn" "$config: $msg" |
|
|
|
sleep 10 |
|
|
@ -147,7 +146,7 @@ ipparam $config |
|
|
|
lcp-max-configure 40 |
|
|
|
ip-up-script /lib/netifd/openfortivpn-ppp-up |
|
|
|
ip-down-script /lib/netifd/ppp-down |
|
|
|
mru 1354" > $callfile |
|
|
|
mru 1354" > "$callfile" |
|
|
|
append_args "--pppd-call=openfortivpn/$config" |
|
|
|
|
|
|
|
logger -p 6 -t openfortivpn "$config: executing 'openfortivpn $cmdline'" |
|
|
@ -161,8 +160,8 @@ proto_openfortivpn_teardown() { |
|
|
|
pwfile="/var/etc/openfortivpn/$config.passwd" |
|
|
|
callfile="/var/etc/openfortivpn/peers/$config" |
|
|
|
|
|
|
|
rm -f $pwfile |
|
|
|
rm -f $callfile |
|
|
|
rm -f "$pwfile" |
|
|
|
rm -f "$callfile" |
|
|
|
proto_kill_command "$config" 2 |
|
|
|
} |
|
|
|
|
|
|
|