mirror of
https://github.com/vincentmli/bpfire.git
synced 2026-04-09 18:45:54 +02:00
VPN-Watch ueberprueft nun ob der Tunnel da ist und nicht der ISAKMP.
VPN-Restart gekillt. git-svn-id: http://svn.ipfire.org/svn/ipfire/trunk@692 ea5c0bd1-69bd-2848-81d8-4f18e57aeed8
This commit is contained in:
@@ -69,7 +69,6 @@ usr/local/bin/setreservedports
|
||||
usr/local/bin/settime
|
||||
usr/local/bin/timecheck
|
||||
usr/local/bin/tunerrd.pl
|
||||
usr/local/bin/vpn-restart
|
||||
usr/local/bin/vpn-watch
|
||||
#usr/local/include
|
||||
#usr/local/lib
|
||||
|
||||
@@ -1,66 +0,0 @@
|
||||
#!/bin/sh
|
||||
# VPN Restart/Checker by Figo
|
||||
|
||||
#####################################################
|
||||
part=xxxx #partner frei W<>hlbar
|
||||
net=xxxx.homeip.net #Partner DYNDNS Adresse
|
||||
vpn=xxxx #VPN Name wie unter GUI
|
||||
iplocal=192.168.x.x #Lokale IP
|
||||
ipremote=192.168.x.x #Partner IP
|
||||
LOGFILE=/var/log/vpn_$vpn.log
|
||||
maxlog=2000 #Max groesse des Logfiles in Byte
|
||||
#####################################################
|
||||
ping -c 3 $net
|
||||
if [ $? != 0 ] ; then
|
||||
clear
|
||||
echo "##############################################"
|
||||
echo "# $part ist offline #"
|
||||
echo "# Verbindung zu $part nicht moeglich #"
|
||||
echo "$(date) $part ist offline #" >> $LOGFILE
|
||||
echo "$(date) Verbindung zu $part nicht moeglich #" >> $LOGFILE
|
||||
echo "##############################################"
|
||||
else
|
||||
clear
|
||||
echo "##############################################"
|
||||
echo "# Na ein Glueck $part is online #"
|
||||
echo "##############################################"
|
||||
/usr/bin/ping -i 2 -c 2 -n -I $iplocal $ipremote
|
||||
if test $? -ne 0; then
|
||||
clear
|
||||
echo "##############################################"
|
||||
echo "# `grep -c ms $LOGFILE` #"
|
||||
echo "# $(date) #"
|
||||
echo "##############################################"
|
||||
echo "$(date) Tunnel zu $part ist NICHT da #" >> $LOGFILE
|
||||
echo "$(date) Starte Tunnel $vpn neu #" >> $LOGFILE
|
||||
echo "# Tunnel zu $part ist NICHT da #"
|
||||
echo "# Starte Tunnel $vpn neu #"
|
||||
echo "##############################################"
|
||||
ipsec auto --replace $vpn
|
||||
ipsec auto --rereadsecrets
|
||||
ipsec auto --up $vpn
|
||||
else
|
||||
clear
|
||||
echo "###############################################"
|
||||
echo "$(date) Tunnel zu $part steht #" >> $LOGFILE
|
||||
echo "# $(date) #"
|
||||
echo "# Tunnel zu $part steht #"
|
||||
echo " seine WAN IP ist `host $net | cut -d" " -f4` "
|
||||
echo "# seine Lokale IP ist $ipremote #"
|
||||
echo "###############################################"
|
||||
|
||||
|
||||
if test `stat -c %s $LOGFILE` -lt $maxlog; then
|
||||
echo "# $LOGFILE < $maxlog Bytes #"
|
||||
else
|
||||
echo "##############################################"
|
||||
echo "# $LOGFILE > $maxlog Bytes #"
|
||||
echo "# Maximale groesse des Logfile #"
|
||||
echo "# Logfile wird geloescht #"
|
||||
echo "##############################################"
|
||||
rm $LOGFILE
|
||||
fi
|
||||
|
||||
fi
|
||||
fi
|
||||
exit 0
|
||||
@@ -50,7 +50,7 @@ foreach (@vpnsettings){
|
||||
my $remoteip = `/usr/bin/ping -c 1 $remotehostname 2>/dev/null | head -n1 | awk '{print \$3}' | tr -d '()' | tr -d ':'`;chomp($remoteip);
|
||||
if ($remoteip eq ""){next;if ($debug){logger("Unable to resolve $remotehostname.");}}
|
||||
my $connected= `ipsec whack --status | grep $remoteip`;
|
||||
my $established= `ipsec whack --status | grep '$settings[2]' | grep 'ISAKMP SA established'`;
|
||||
my $established= `ipsec whack --status | grep '$settings[2]' | grep 'IPsec SA established'`;
|
||||
|
||||
if ( $established eq '' || $connected eq '' ){
|
||||
logger("Remote IP for host $remotehostname has changed or no connection is established, restarting connection to $remoteip.");
|
||||
|
||||
Reference in New Issue
Block a user