Quantcast
Channel: Active questions tagged openvpn - Unix & Linux Stack Exchange
Viewing all articles
Browse latest Browse all 823

OpenVPN using Luci (OpenWRT) ssh commands to get instances and enable/disable them

$
0
0

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:

enter image description here

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=openvpnopenvpn.test0.config='/etc/openvpn/test0.ovpn'openvpn.test0.enabled='1'openvpn.test1=openvpnopenvpn.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     NAMEopenvpn   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  28722test1 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!


Viewing all articles
Browse latest Browse all 823

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>