Monitor of VPN and sending emails
-
HI All,
Im trying to get my Pfsense to send an email when if and when my Site to Site VPN goes offline.
I have set up the VPN and its online.
I have then gone to gateways and added a LAN gateway with no gateway IP address but a monitor IP address of the router on the other side of the VPN. This seems to work fine. I can disable the VPN on the other side and the pfsense shows the "gateway" as down with packet loss. I can re enable it on the other side and it comes back up.
I have 2 problems though.
1st if i reboot the pfsense the gateway never comes back up. i have to totally rebuild the gateway for it to monitor again.
and second for some reason it will not send me an email saying that the gateway is down.
It sends me emails for when its rebooting or upgrading etc. so i know the SMTP setting are correct but for the life of me i cant get it to send an email when the "gateway" is down.
Any help would be appreciated.
-
@john-bonnell Perhaps you could provide some more information on your setup. Like which version of pfsense and what VPN protocol you are using. At least with Wireguard I have not had any issues with them coming back after a reboot. With IPSec I currently have both pfsense the remote system set to initiate the connection (Under Advanced Options - Child SA Start Action).
The email part, I don't really know as I am not using it... However, I think you should be able to use the package called Service_Watchdog which you can install and then set it up to monitor and send notifications?
-
@Gblenn
HI,
Sorry the VPN's are coming back up no problem its just the the "gateway" is showing down. Its not its just the monitoring bit.The version i have tried it on 2.7.2 and 24.11 Pfsense +
I will give service_watchdog a try
-
@john-bonnell said in Monitor of VPN and sending emails:
It sends me emails for when its rebooting or upgrading etc. so i know the SMTP setting are correct but for the life of me i cant get it to send an email when the "gateway" is down.
You have to 'create' this yourself.
You'll need the OpenVPN server (or client) manual. Not an issue, as OpenVPN is one of worlds most documented service. Remember : its OpenSource !.On this forum teher are examples how to send a mail if a OpenVPN user connects to openvpn server. You can use these as a guide line, so you know where to start.
IFAIK (remember) : you can give the OpenVPN server (or client) process a script file as a parameter, and this script file parses out out the type of events that the OpenVPN server signals.
You will be looking for the "connection lost" event, and act upon that.Sending a mail is possible. See here for an example.
Btw : normally, a connection between your two VPN sides is always 'up'. If your VPN goes down, changes are great that it concerns your 'uplink' to the Internet (both sides).
Sending a mail from that side will then be impossible. -
@john-bonnell Aha, makes sense, so that I have seen happening and I had to restart the gateway monitoring daemon from the dashboard. But most of the time, it works fine. Have not really investigated why this happens, as it's been ok for the most part. And I reboot extremely seldom....
-