Open jomsky10 opened 7 years ago
Currently we don't require any storage, and we don't save state anywhere.
This would require a db to store the records, and an external program that constantly polls the management interface for the information (e.g. run by cron).
+1
+1
+1
This can't be done in a robust way from the OpenVPN management interface (which is how openvpn-monitor connects to the server). For starters:
The far better way is to use OpenVPN's hooks to have it log when users connect/disconnect. It's trivial to write a script that reads env vars and writes them to a log file. Just add that script to OpenVPN's config file as:
client-connect /path/to/script
client-disconnect /path/to/script
This can't be done in a robust way from the OpenVPN management interface (which is how openvpn-monitor connects to the server). For starters:
- OpenVPN only allows a single client connection at a time
- openvpn-monitor is typically that client
- openvpn-monitor only runs when you refresh the web page (by default every 5 minutes) -- there are huge opportunities for users to connect, do stuff and disconnect between those 5 minute polls.
- what happens when 4 admins all have the openvpn-monitor web page open? You'd have a hard time avoiding duplicate log entries.
The far better way is to use OpenVPN's hooks to have it log when users connect/disconnect. It's trivial to write a script that reads env vars and writes them to a log file. Just add that script to OpenVPN's config file as:
client-connect /path/to/script
client-disconnect /path/to/script
What should the scripts contain?
this is not a necessary feature but it would be great if it will be added to openvpn-monitoring since admins of openvpn is not 24/7 online so they can't always trace or see if there are client who shares their account and use it at the same time. :)
reference from Chocobozzz :)