From af81bac4569ddc015069a636f8cbaf401f04063e Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Thu, 7 Feb 2008 23:24:18 -0500 Subject: [PATCH] Added ipmasq rule file to restart fail2ban when iptables are wiped out (closes: #461417). Thanks Guido Bozzetto --- files/ipmasq-ZZZzzz|fail2ban.rul | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 files/ipmasq-ZZZzzz|fail2ban.rul diff --git a/files/ipmasq-ZZZzzz|fail2ban.rul b/files/ipmasq-ZZZzzz|fail2ban.rul new file mode 100644 index 00000000..e371208d --- /dev/null +++ b/files/ipmasq-ZZZzzz|fail2ban.rul @@ -0,0 +1,31 @@ +#! /bin/sh +# +# ZZZzzz|fail2ban.rul +# +# Ultima modifica: 20060112 Creazione +# Ultima modifica: 20071205 Verifica sia in esecuzione +# +# Riconfigura le regole di filtraggio relative a fail2ban alla fine +# dell'inizializzazione delle regole. +# Solo all'avvio del sistema mostra la (ri)esecuzione dello script + +_NAME=fail2ban +_INITSCRIPT=/etc/init.d/$_NAME +_CONFIG="/etc/$_NAME/$_NAME.local /etc/$_NAME/$_NAME.conf" + +if [ -s $_INITSCRIPT ]; then + SOCKFILE=`sed -n -e '/^[^#]*socket\s*=/{ + s/.*socket\s*=\s*\(\S\+\).*/\1/p;q}' $_CONFIG 2>/dev/null` + [ -z "$SOCKFILE" ] && SOCKFILE="/tmp/$_NAME.sock" + if [ -S "$SOCKFILE" ]; then # Is daemon running ? + if [ "$SHOWRULES" == "yes" ]; then + echo "#: Reinitializing $_NAME" + echo $_INITSCRIPT force-reload + else + [ ! $runlevel ] && HIDEOUTPUT=true + fi + if [ "$NOACT" != "yes" ]; then + eval $_INITSCRIPT force-reload ${HIDEOUTPUT:+\>/dev/null 2\>&1} + fi + fi # SOCKFILE is a socket +fi # _INITSCRIPT exist