I'd like to give users a certain amount of traffic. Let's say user A
gets 1 GB and user B
get 5 GB.
I have a great script which does log all this info, however this script is called when the user disconnects (client-disconnect
).
Now, my problem is the following: what if user A
uses up 1 GB of data and simply never disconnects? He would be able to use thousands of GB's. Is there any way run a specific script periodically within OpenVPN (so no crontab
, since OpenVPN passes environment variables).
I think you should enable the management interface on your OpenVPN server.
Then write a program that you will periodically run from cron or something. The script will connect to the management port, issue the
status
command, parse the data and store it somewhere that you can use by your other scripts that disconnect clients, or prevent access. You can also issue disconnects via the management port.