aboutsummaryrefslogtreecommitdiff
path: root/shorewall_script
diff options
context:
space:
mode:
authorLucas Castro <lucas@gnuabordo.com.br>2024-01-10 22:33:44 -0300
committerLucas Castro <lucas@gnuabordo.com.br>2024-01-10 22:33:44 -0300
commita4270020addc324fb60d2b1b446b41bc31e3baf8 (patch)
tree8708f08c66a63f08c0cd88ab1a46faadcd3f4706 /shorewall_script
Import Upstream version 1.0.4upstream/1.0.4
Diffstat (limited to 'shorewall_script')
-rw-r--r--shorewall_script53
1 files changed, 53 insertions, 0 deletions
diff --git a/shorewall_script b/shorewall_script
new file mode 100644
index 0000000..b9aa859
--- /dev/null
+++ b/shorewall_script
@@ -0,0 +1,53 @@
+#!/bin/sh
+#
+# Copyright (C) 2009,2013 Mika Ilmaranta <ilmis@nullnet.fi>
+# Copyright (C) 2009-2010,2015 Tuomo Soini <tis@foobar.fi>
+#
+# License: GPLv2
+#
+
+#
+# event handling script for use with shorewall multi-isp setup
+# To be able to utilize this script you must have shorewall >= 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=$(shorewall show vardir)
+VARDIR=${VARDIR:-/var/lib/shorewall}
+
+echo ${state} > ${VARDIR}/${DEVICE}.status
+
+if [ -x ${VARDIR}/firewall ]; then
+ ${VARDIR}/firewall ${action} ${DEVICE}
+else
+ shorewall -q restart
+fi
+
+exit 0
+#