furlongm / openvpn-monitor

openvpn-monitor is a web based OpenVPN monitor, that shows current connection information, such as users, location and data transferred.
http://openvpn-monitor.openbytes.ie
GNU General Public License v3.0
968 stars 297 forks source link

Feature Request — Client History Logs #27

Open jomsky10 opened 7 years ago

jomsky10 commented 7 years ago

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. :)

image

reference from Chocobozzz :)

furlongm commented 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).

csib commented 7 years ago

+1

zeleanon commented 6 years ago

+1

aristella commented 6 years ago

+1

TheAmigo commented 6 years ago

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

katomic commented 5 years ago

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?