Browse Source

openconnect: fix a couple of minor things and add an interface option

Signed-off-by: Daniel Gimpelevich <daniel@gimpelevich.san-francisco.ca.us>
lilik-openwrt-22.03
Daniel Gimpelevich 9 years ago
parent
commit
41f8d54650
3 changed files with 10 additions and 5 deletions
  1. +1
    -1
      net/openconnect/Makefile
  2. +1
    -0
      net/openconnect/README
  3. +8
    -4
      net/openconnect/files/openconnect.sh

+ 1
- 1
net/openconnect/Makefile View File

@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=openconnect
PKG_VERSION:=7.04
PKG_RELEASE:=1
PKG_RELEASE:=2
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=ftp://ftp.infradead.org/pub/openconnect/


+ 1
- 0
net/openconnect/README View File

@ -4,6 +4,7 @@ To setup a VPN connection, add the following to /etc/config/network:
config interface 'MYVPN'
option proto 'openconnect'
option interface 'wan'
option server 'vpn.example.com'
option port '4443'
option username 'test'


+ 8
- 4
net/openconnect/files/openconnect.sh View File

@ -10,6 +10,9 @@ proto_openconnect_init_config() {
proto_config_add_string "serverhash"
proto_config_add_string "authgroup"
proto_config_add_string "password"
proto_config_add_string "token_mode"
proto_config_add_string "token_secret"
proto_config_add_string "interface"
no_device=1
available=1
}
@ -17,14 +20,14 @@ proto_openconnect_init_config() {
proto_openconnect_setup() {
local config="$1"
json_get_vars server port username serverhash authgroup password vgroup token_mode token_secret
json_get_vars server port username serverhash authgroup password interface token_mode token_secret
grep -q tun /proc/modules || insmod tun
logger -t openconnect "initializing..."
serv_addr=
for ip in $(resolveip -t 10 "$server"); do
( proto_add_host_dependency "$config" "$ip" )
( proto_add_host_dependency "$config" "$ip" $interface )
serv_addr=1
done
[ -n "$serv_addr" ] || {
@ -57,7 +60,8 @@ proto_openconnect_setup() {
[ -n "$username" ] && append cmdline "-u $username"
[ -n "$password" ] && {
umask 077
pwfile="/var/run/openconnect-$config.passwd"
mkdir -p /var/etc
pwfile="/var/etc/openconnect-$config.passwd"
echo "$password" > "$pwfile"
append cmdline "--passwd-on-stdin"
}
@ -78,7 +82,7 @@ proto_openconnect_setup() {
proto_openconnect_teardown() {
local config="$1"
pwfile="/var/run/openconnect-$config.passwd"
pwfile="/var/etc/openconnect-$config.passwd"
rm -f $pwfile
logger -t openconnect "bringing down openconnect"


Loading…
Cancel
Save