[OpenVPN home] [Date Prev] [Date Index] [Date Next]
[OpenVPN mailing lists] [Thread Prev] [Thread Index] [Thread Next]
Google
 
Web openvpn.net

Re: [Openvpn-users] Openvpn simple tracking script


  • Subject: Re: [Openvpn-users] Openvpn simple tracking script
  • From: Erich Titl <erich.titl@xxxxxxxx>
  • Date: Mon, 09 Apr 2007 11:54:20 +0200

Hi

dassey@xxxxxxxxx schrieb:
> FC4
> OpenVPN 2.1_rc2
>
>
> I have looked at a bunch of accounting methods lately and they seem 
> good, except hard to implement (for newb). But I do not want to change 
> the actual process that the OpenVPN goes through now. I want it to 
> authenticate the way it does, assign the IP's the way it does, etc. I 
> just want a simple way of tracking per user/cn bandwidth.

use client-connect and client-disconnect scripts and write to the 
standard unix logging
 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
widelan-stallikon# cat client-connect
#!/bin/sh

LOGGER=/usr/bin/logger
HOSTNAME=`hostname`
SCRIPT=`basename $0`

$LOGGER -plocal3.info -t "$HOSTNAME openvpn $SCRIPT" "${common_name}"
widelan-stallikon#*
*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
widelan-stallikon# cat client-disconnect
#!/bin/sh

LOGGER=/usr/bin/logger
HOSTNAME=`hostname`
SCRIPT=`basename $0`

$LOGGER -plocal3.info -t "$HOSTNAME openvpn $SCRIPT" ${common_name} 
bytes: ${bytes_sent}/${bytes_received}
widelan-stallikon#

 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

This will result on a central server some how like this

Apr  9 11:50:19 widelan-stallikon widelan-stallikon openvpn client-connect:
Apr  9 11:50:24 widelan-stallikon widelan-stallikon openvpn 
client-disconnect: bytes: /
Apr  9 11:52:08 gatekeeper gatekeeper openvpn client-connect:
Apr  9 11:52:11 gatekeeper gatekeeper openvpn client-disconnect: bytes: /

of course there will be more information in case of a real 
connect/disconnect.

you can set up your logging to go to a central host and then use 
logsurfer or something similar for analysis.

cheers

Erich
______________________
OpenVPN mailing lists
https://lists.sourceforge.net/lists/listinfo/openvpn-users