#!/bin/sh # # Copyright (C) 2015 Tuomo Soini # # License: GPLv2 # # # event handling script for use with shorewall6 multi-isp setup # To be able to utilize this script you must have shorewall6 >= 4.4.23.3 # STATE=${1} NAME=${2} CHECKIP=${3} DEVICE=${4} WARN_EMAIL=${5} REPLIED=${6} WAITING=${7} TIMEOUT=${8} REPLY_LATE=${9} CONS_RCVD=${10} CONS_WAIT=${11} CONS_MISS=${12} AVG_RTT=${13} SRCIP=${14} PREVSTATE=${15} TIMESTAMP=${16} DATE=$(date --date=@${TIMESTAMP}) if [ ${STATE} = up ]; then state=0 action=enable else state=1 action=disable fi VARDIR=$(shorewall6 show vardir) VARDIR=${VARDIR:-/var/lib/shorewall6} echo ${state} > ${VARDIR}/${DEVICE}.status if [ -x ${VARDIR}/firewall ]; then ${VARDIR}/firewall ${action} ${DEVICE} else shorewall6 -q restart fi exit 0