List which VPN clients are connected

Solution 1:

You can do this with a small expect-script:

#!/usr/bin/expect
spawn telnet localhost 7505
set timeout 10
expect "OpenVPN Management Interface"
send "status 3\r"
expect "END"
send "exit\r"

And run it with (e.g.)
while true; do ./openVPNUserlist.sh |grep -e ^CLIENT_LIST; sleep 1; done

Also, in your server.conf - file, add the line
management localhost 7505

Packages you need to have installed:
telnet expect

Interestingly, the status does only update after a while (when a client disconnects, it keeps being displayed in the status for quite a while... Did not find a way to get around this yet :(
Change the timeout in your server.conf to the values you need:
keepalive 10 60
= ping client every 10 seconds and consider it disconnected after 1 minute.

Solution 2:

I located extensive vpn logs in this folder:

ls /var/log/openvpn/

For me, there were two files there, named kind of like this:

Arbitary-Name-VPN.log
status-Arbitary-Name-VPN.log

The first file showed a log of all vpn connections that have happened over time, and the second one (status-...) showed who is connected right now.