Hey all I have been researching how to go about doing this but I have not really found anything on it.
What I am trying to do is,
use SSH luci, get a list of all my
OpenVPN instances:
And be able to enable anyone of them by their Name.
So far the only
ssh command(s) I have found to list my
OpenVPN instances are:
uci show openvpn
Which produces an
output like this:
......[more output here]....
openvpn.sample_client.cert='/etc/openvpn/client.crt'
openvpn.sample_client.key='/etc/openvpn/client.key'
openvpn.sample_client.verb='3'
openvpn.test0=openvpn
openvpn.test0.config='/etc/openvpn/test0.ovpn'
openvpn.test0.enabled='1'
openvpn.test1=openvpn
openvpn.test1.config='/etc/openvpn/test1.ovpn'
And
tail /etc/config/openvpn
Which produces an
output like this:
option key '/etc/openvpn/client.key'
option verb '3'
config openvpn 'test0'
option config '/etc/openvpn/test0.ovpn'
option enabled '1'
config openvpn 'test1'
option config '/etc/openvpn/test1.ovpn'
And
lsof /usr/sbin/openvpn
Which produces an
output like this:
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
openvpn 28722 root txt REG 0,16 450687 250828 /usr/sbin/openvpn
Which would just be nice if I can use
grep to just get the
names and it's
PID from the above
ssh commands instead of getting all that other data along with it.
Ideally I would like the
output to be like this (
instance name, enabled/disabled and
PID):
test0 enabled 28722
test1 disabled
And I know that using:
/etc/init.d/openvpn stop
or
kill -9 <PID>
to stop the current enabled running instance and
/etc/init.d/openvpn start
to start the current enabled running instance.
Other than that I can not seem to find the proper way of
enabling and
disabling an
OpenVPN instance by it's
name or
PID.
Any help would be great!