summaryrefslogtreecommitdiff
path: root/pcr/vuurmuur/vuurmuur.script
diff options
context:
space:
mode:
authorAndré Fabian Silva Delgado <emulatorman@lavabit.com>2012-11-23 16:00:21 -0200
committerAndré Fabian Silva Delgado <emulatorman@lavabit.com>2012-11-23 16:00:21 -0200
commit13e7da299d6c1d313b32309f5737d887212b7d4c (patch)
treed4f484d0a730e8f66f3412d1535ff561adf7dea9 /pcr/vuurmuur/vuurmuur.script
parente0755bc7fa7cd05b992a9988a9d38587e169f42d (diff)
parente61f24169547faea84a6b813212bac030feaacd1 (diff)
Merge branch 'master' of ssh://parabolagnulinux.org:1863/srv/git/abslibre
Diffstat (limited to 'pcr/vuurmuur/vuurmuur.script')
-rw-r--r--pcr/vuurmuur/vuurmuur.script88
1 files changed, 88 insertions, 0 deletions
diff --git a/pcr/vuurmuur/vuurmuur.script b/pcr/vuurmuur/vuurmuur.script
new file mode 100644
index 000000000..a643d6fbd
--- /dev/null
+++ b/pcr/vuurmuur/vuurmuur.script
@@ -0,0 +1,88 @@
+#!/bin/bash
+
+VUURMUURPID='/run/vuurmuur.pid'
+VUURMUURLOGPID='/run/vuurmuur_log.pid'
+start() {
+ IFNUM=`/usr/bin/vuurmuur_script --list --interface any | wc -l`
+ if [ $IFNUM = 0 ]; then
+ echo "Please configure Vuurmuur first by defining at least one interface."
+ exit 1
+ fi
+
+ # load modules
+ . /etc/vuurmuur/modules.conf
+ for MODULE in `echo $MODULES_TO_LOAD`; do
+ /sbin/modprobe $MODULE &>/dev/null
+ if [ $? != 0 ]; then
+ echo "Error when loading module $MODULE. Check log files."
+ exit 1
+ fi
+ done
+
+ # start vuurmuur daemon
+ if [ ! -f $VUURMUURPID ]; then
+ /usr/bin/vuurmuur -l
+ if [ $? != 0 ]; then
+ echo "Error when starting Vuurmuur daemon. Check log files."
+ STATUS="failed"
+ fi
+ else
+ PID=`cat $VUURMUURPID | cut -d " " -f 1`
+ echo "Error when starting Vuurmuur daemon. Already running at pid $PID."
+ STATUS="failed"
+ fi
+
+ # start vuurmuur log parsing daemon
+ if [ ! -f $VUURMUURLOGPID ]; then
+ /usr/bin/vuurmuur_log
+ if [ $? != 0 ]; then
+ echo "Error when starting Vuurmuur log parsing daemon. Check log files."
+ STATUS="failed"
+ fi
+ else
+ PID=`cat $VUURMUURLOGPID | cut -d " " -f 1`
+ echo "Error when starting Vuurmuur log parsing daemon. Already running at pid $PID."
+ STATUS="failed"
+ fi
+
+ # finalize
+ if [ $STATUS = "failed" ]; then
+ exit 1
+ fi
+}
+stop() {
+ # initialize
+ echo "Stopping Vuurmuur Firewall"
+ STATUS="ok"
+
+ # stop vuurmuur log parsing daemon
+ PID=`cat $VUURMUURLOGPID | cut -d " " -f 1`
+ if [[ ! -z $PID ]] && kill "$PID" &>/dev/null; then
+ rm -f $VUURMUURLOGPID
+ else
+ echo "Error when stopping Vuurmuur log parsing daemon. Check log files."
+ STATUS="failed"
+ fi
+
+ # stop vuurmuur daemon
+ PID=`cat $VUURMUURPID | cut -d " " -f 1`
+ if [[ ! -z $PID ]] && kill "$PID" &>/dev/null; then
+ rm -f $VUURMUURPID
+ else
+ echo "Error when stopping Vuurmuur daemon. Check log files."
+ STATUS="failed"
+ fi
+
+ # finalize
+ if [ $STATUS = "false" ]; then
+ exit 1
+ fi
+}
+restart() {
+ $0 stop
+ $0 start
+}
+
+case $1 in
+ start|stop|restart) "$1" ;;
+esac