Koozali.org: home of the SME Server

How to setup a notification alert when VPN connection established?

Offline cubique

  • 4
  • +0/-0
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

Offline Stefano

  • *
  • 10,894
  • +3/-0
Re: How to setup a notification alert when VPN connection established?
« Reply #1 on: August 04, 2009, 07:15:33 PM »
hi

you should use something like swatch 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