BobbyJ1's picture

What is the easier way to see who is connected?

I can look at the  /var/log/openvpn/server.log using the web gui but its not live its ok data.

Is there a built in file that gets updated with who is connected?   If not it should be part of the installation package.

Forum: 
Jeremy Davis's picture

According to google (TBH, I'm not particularly familiar with OpenVPN) if you have this line in your config (/etc/openvpn/server.conf):

status /var/log/openvpn-status.log

Then you could create a script to poll the log and report. According to StackExchange something like this should work:

while true; do
    sed -n '/OpenVPN CLIENT LIST/,/ROUTING TABLE/p' /var/log/openvpn-status.log | tail -n+4 | sed "s/ROUTING TABLE//g"
    sleep 60
done

(I mildly modified the script, but the above should give identical result). To set that up so it runs all the time, you'd probably want to create a fairly simple systemd service and then you could check for connections via the journal. Or log to a specific (different) file.

Please let me know how it goes and if we can confirm that it works then we could consider adding it to the appliance by default.

Nick Xu's picture

Hello Jeremy I was facing a similar request to view which users are connected to my OpenVPN server. And I'll have to say that "/etc/openvpn/server.conf" doesn't exist in the current release of Turnkey's OpenVPN build. It seems the original post author's method is the only one available, which is to look at the content in /var/log/openvpn/server.log file. Cheers Nick
Jeremy Davis's picture

Hi Nick

Thanks for taking the time to test this and report back. Unfortunately I'm really snowed under with a mile long backlog and don't have time to look at this in further detail right now, but it would definitely be a great feature - one that lots of users could benefit from.

Regardless, I've opened a related feature request on our consolidated issue tracker. At least it won't get forgotten now and hopefully I (or one of our contract devs) can circle back to it at some point in the not too distant future.

If you have a closer look yourself and work something out, please do share - either here or on the GH issue. That will be helpful for others and likely be the basis for us including that functionality in a future release.

Add new comment