Re: Client history

mike tancsa <[email protected]>
Newsgroups gmane.network.openvpn.user
Message-ID <[email protected]>
On 2/13/2024 1:37 PM, Peter Davis wrote:
> > On Tuesday, February 13th, 2024 at 9:58 PM, mike tancsa 
> <[email protected]> wrote:
>> On 2/13/2024 1:13 PM, Peter Davis via Openvpn-users wrote:
>>> Hello,
>>> 1- Is there a way to report when clients connect and disconnect?
>>>
>>> 2- Is it possible to notify the connection of a specific client to 
>>> the server through email?
>>>
>> On the server, you can use the client-connect/disconnect config. Just 
>> fire whatever script you want from there to do whatever notification 
>> you want. Various environment vars get populated (e.g. X509_0_CN) 
>> that you can save as needed and tune your notifications to match what 
>> you need.
>>
>> client-connect "/usr/local/etc/openvpn/connect.sh"
>> client-disconnect "/usr/local/etc/openvpn/disconnect.sh"
>>
>>
> Hi,
> Thank you.
> I mean, does OpenVPN itself have the ability to keep the IP address of 
> the client and the time it is connected to the server somewhere for 
> reporting?

I am not sure what you are after. OpenVPN keeps track of all that 
information and more (IP address of the client, time, username etc) and 
exports them in environment variables which you can make use of at 
client connect / disconnect time. You can then do with them as you 
require to meet your reporting requirements.

e.g. here is what I log

Feb 12 01:01:30 gate2a UP[85616]: joe-mac ME 10.21.1.1 REMOTE 10.21.1.38 
FROM 129.222.114.2
Feb 12 01:02:38 gate2a DOWN[85759]: joe-mac ME 10.21.1.1 REMOTE 
10.21.1.38 FROM 129.222.114.2


the connect.sh script that logs that in one of my server's openvpn.conf 
file.

/usr/bin/logger -p local2.notice -t UP $common_name ME $ifconfig_local 
REMOTE $ifconfig_pool_remote_ip FROM $untrusted_ip


     ---Mike

_______________________________________________
Openvpn-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.