What's new
  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

[SOLVED] Extracting openvpn connection status from the web interface

mad_ady

Regular Contributor
I'd like to know if there is some sort of API that would allow me to extract openvpn connection status from the web interface? For example, in this image, I'd like to be able to extract the user connected and their IP address: http://imgur.com/GCz61fN.png

I've looked at the page (/www/Advanced_VPNStatus.asp) and there are a lot of markup calls like:

<% nvram_get("wan_proto"); %>

I'd like to know if there is a way to get this data from running code inside the router (I have access to the nvram for example), or if I should scrape the webpage, or maybe the data is accessible some place else in the filesystem (e.g. a log or a temporary file)?

I can get the current connections to both my servers with this:
netstat -tan | egrep "443|1194" | grep ESTABLISHED

But I don't have the IP - Username mapping

Any ideas how I can get that?
 
I'd like to know if there is some sort of API that would allow me to extract openvpn connection status from the web interface? For example, in this image, I'd like to be able to extract the user connected and their IP address: http://imgur.com/GCz61fN.png

I've looked at the page (/www/Advanced_VPNStatus.asp) and there are a lot of markup calls like:

<% nvram_get("wan_proto"); %>

I'd like to know if there is a way to get this data from running code inside the router (I have access to the nvram for example), or if I should scrape the webpage, or maybe the data is accessible some place else in the filesystem (e.g. a log or a temporary file)?

I can get the current connections to both my servers with this:
netstat -tan | egrep "443|1194" | grep ESTABLISHED

But I don't have the IP - Username mapping

Any ideas how I can get that?

You can extract the information needed from the following files:

/etc/openvpn/server1/status respectively from /etc/openvpn/server2/status
 
Every few seconds, running instances will dump their status info in these files (they exist only if the associated instance actually runs):

Code:
/etc/openvpn/server1/status
/etc/openvpn/server2/status
/etc/openvpn/client11/status through /etc/openvpn/client5/status

You can also tell an OpenVPN process to dump its data to syslog by sending it a SIGUSR2 signal.
 

Support SNBForums w/ Amazon

If you'd like to support SNBForums, just use this link and buy anything on Amazon. Thanks!

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Back
Top