Koozali.org: home of the SME Server

Contribs.org Forums => General Discussion => Topic started by: cubique on August 04, 2009, 04:34:37 PM

Title: How to setup a notification alert when VPN connection established?
Post by: cubique on August 04, 2009, 04:34:37 PM
Hi,

I have SME 7.4. I want to setup a "rule" that send an email alert message (to my email address) each time a VPN connection is established. (btw: I use the default SME VPN service on pptp protocol).

The message should contains at least the following info:
- hostname/IP address of client connected
- login name of client connected
- connection date/time

I have no ideea how to do it or if it is possible to do it.
Any advice would by appreciated.
Eugen
Title: Re: How to setup a notification alert when VPN connection established?
Post by: Stefano on August 04, 2009, 07:15:33 PM
hi

you should use something like swatch (http://dries.ulyssis.org/rpm/packages/swatch/info.html) to monitor  /var/log/messages for the string "control connection started], then call a custom script that grep some info from /var/log/radius/accounting.log

from the first you get the remote ip and date/time of connection
Example:
Quote
Aug  2 00:22:31 fileserver pptpd[2895]: CTRL: Client XX.XX.XX.XX control connection started
Aug  2 15:05:06 fileserver pptpd[1499]: CTRL: Client XX.XX.XX.XX control connection started
Aug  2 22:26:18 fileserver pptpd[7337]: CTRL: Client XX.XX.XX.XX control connection started

from the second you can recover many, many information..

if you find a way to do what you wish, please share here, thank you

Ciao
Stefano
swatch sh