openconnect: introduced script parameter

This allows specifying a custom vpnc-compatible config script.

Signed-off-by: Yury Potapov <me@immensus.net>
This commit is contained in:
Yury Potapov
2024-10-15 18:14:51 +03:00
committed by Nikos Mavrogiannopoulos
parent 1fcaf0ac1f
commit 185c5f0387
3 changed files with 8 additions and 2 deletions

View File

@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=openconnect PKG_NAME:=openconnect
PKG_VERSION:=9.12 PKG_VERSION:=9.12
PKG_RELEASE:=4 PKG_RELEASE:=5
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://www.infradead.org/openconnect/download PKG_SOURCE_URL:=https://www.infradead.org/openconnect/download

View File

@@ -18,6 +18,9 @@ config interface 'MYVPN'
# Reconnect after a temporary network down time (in seconds) # Reconnect after a temporary network down time (in seconds)
#option reconnect_timeout '30' #option reconnect_timeout '30'
# Shell command line for using a vpnc-compatible config script (default: "/lib/netifd/vpnc-script")
# option script '/lib/netifd/vpnc-script'
# For second factor auth: # For second factor auth:
# when a fixed 2FA password can be used # when a fixed 2FA password can be used

View File

@@ -37,6 +37,7 @@ proto_openconnect_init_config() {
proto_config_add_string "csd_wrapper" proto_config_add_string "csd_wrapper"
proto_config_add_string "proxy" proto_config_add_string "proxy"
proto_config_add_array 'form_entry:regex("[^:]+:[^=]+=.*")' proto_config_add_array 'form_entry:regex("[^:]+:[^=]+=.*")'
proto_config_add_string "script"
no_device=1 no_device=1
available=1 available=1
} }
@@ -73,6 +74,7 @@ proto_openconnect_setup() {
token_secret \ token_secret \
usergroup \ usergroup \
username \ username \
script \
ifname="vpn-$config" ifname="vpn-$config"
@@ -101,7 +103,8 @@ proto_openconnect_setup() {
[ -n "$port" ] && port=":$port" [ -n "$port" ] && port=":$port"
[ -z "$uri" ] && uri="$server$port" [ -z "$uri" ] && uri="$server$port"
append_args "$uri" -i "$ifname" --non-inter --syslog --script /lib/netifd/vpnc-script append_args "$uri" -i "$ifname" --non-inter --syslog
[ -n "$script" ] && append_args --script "$script"
[ "$pfs" = 1 ] && append_args --pfs [ "$pfs" = 1 ] && append_args --pfs
[ "$no_dtls" = 1 ] && append_args --no-dtls [ "$no_dtls" = 1 ] && append_args --no-dtls
[ -n "$mtu" ] && append_args --mtu "$mtu" [ -n "$mtu" ] && append_args --mtu "$mtu"