Add Fail2ban support to check. Restart fail2ban if the f2b chains are not active in firewall
git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@4200 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
16
check
16
check
@@ -57,7 +57,7 @@ function checklog()
|
||||
echo "$@"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
function chercheLanceur()
|
||||
{
|
||||
# Cette fonction renvoie le lanceur du programme passé en paramètre
|
||||
@@ -328,6 +328,20 @@ function testFichierPresent
|
||||
fi
|
||||
}
|
||||
|
||||
function testFail2BanActive
|
||||
{
|
||||
## Cette fonction verifie si des chaines f2b- existent bien dans iptables
|
||||
## Si ce n'est pas le cas, essaie de redémarrer fail2ban
|
||||
if [ ! -e "/etc/init.d/fail2ban" ]; then
|
||||
checklog "ERREUR : /etc/init.d/fail2ban introuvable"
|
||||
else
|
||||
/sbin/iptables -L -nv |egrep -q "^Chain f(ail)?2b(an)?-" || (
|
||||
checklog "ERREUR : fail2ban absent dans iptables : redémarrage";
|
||||
/etc/init.d/fail2ban stop ;
|
||||
/etc/init.d/fail2ban start )
|
||||
fi
|
||||
}
|
||||
|
||||
if [ ! -f "/etc/check.conf" ]; then
|
||||
echo "Le fichier /etc/check.conf n'existe pas : EXIT"
|
||||
exit
|
||||
|
||||
Reference in New Issue
Block a user