remote start of openconnect client fails

Pavel Lisý pavel.lisy at gmail.com
Sat Feb 6 12:58:11 PST 2016


Hello

I would like to start openconnect client by remotely by ssh.

This is my use case:
* on gateway is correct openconnect configuration, root can start VPN
and it is working
* I want run script (by normal user through sudo) on developer server
which should start vpn on gateway
* vpn-start script on gateway should start only after connection with
specific ssh private key
   (through command= directive in authorized_keys2)

This works without problem for openvpn, vpnc, pptp VPNs. But there is
something strange with openconnect. 


I will try to explain where:
* in script "customer-connect" on gateway is openconnect part:
-----------
cat /etc/openconnect/${CUSTOMER}.pw | \
   /usr/sbin/openconnect --config=/etc/openconnect/${CUSTOMER}.conf
"$OPENCONNECT_HOST"
-----------

in ${CUSTOMER}.conf is:
-----------
interface=tun5015
user=user_customer
authgroup=group_customer
passwd-on-stdin
quiet
no-dtls
no-cert-check
background
syslog
pid-file=/var/run/openconnect/pid_customer
-----------

* when I run script customer-connect directly on gateway:
	it starts VPN and script ends,
	I can run another bash commands

* when I run script customer-connect from devel server directly through
ssh:
	it starts VPN on gateway but script does not end, 
 	it means I cannot run another bash commands until I press
Ctrl-C
	than VPN is still working

* when I put "customer-connect" to command= directive in file
.ssh/authorized_keys2 on gateway:
	helper script connect through ssh with specific private key to
gateway and run script from authorized_keys2, 
	it starts VPN on gateway but only for few seconds and than VPN
is terminated
	ssh is disconnected and I can run another bash commands on
devel server

Can you explain me, why it works this way. I suppose it is bug, but I
dont know where.

Pavel Lisy
-- 
Pavel Lisý <pavel.lisy at gmail.com>



More information about the openconnect-devel mailing list