aboutsummaryrefslogtreecommitdiff
path: root/files
diff options
context:
space:
mode:
authorKilian Engelhardt <kilian.engelhardt@gmail.com>2019-04-03 17:16:46 +0200
committerKilian Engelhardt <kilian.engelhardt@gmail.com>2019-04-03 17:16:46 +0200
commite02ac8cecac8a9db197b6696dadd137f400275f2 (patch)
treebeb0d4be205a3ab8de85298765fe6827f6940b30 /files
parentf6bbb6a48f853a5557bbe4718228496a7143d664 (diff)
downloadpuppet-ferm-e02ac8cecac8a9db197b6696dadd137f400275f2.tar.gz
puppet-ferm-e02ac8cecac8a9db197b6696dadd137f400275f2.tar.bz2
add init script inspired by Kellermann's script for Debian
Diffstat (limited to 'files')
-rwxr-xr-xfiles/ferm69
1 files changed, 69 insertions, 0 deletions
diff --git a/files/ferm b/files/ferm
new file mode 100755
index 0000000..3982eec
--- /dev/null
+++ b/files/ferm
@@ -0,0 +1,69 @@
+#!/bin/sh
+
+# -----------------------------------------------------------------------------
+# ------------------------[ MANAGED BY PUPPET ]--------------------------------
+# -----------------------------------------------------------------------------
+#
+# ferm Configure ferm firewall rules from /etc/ferm.conf
+#
+# Inspired by Max Kellermann <max@duempel.org>
+#
+# Version: $Revision: 001 $
+### BEGIN INIT INFO
+# Provides: ferm
+# Required-Start: $network $remote_fs
+# Required-Stop: $network $remote_fs
+# Default-Start: 2 3 4 5
+# Default-Stop: 0 1 6
+# Description: Starts ferm firewall configuration
+# short-description: ferm firewall configuration
+### END INIT INFO
+
+PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
+FERM=/usr/sbin/ferm
+CONFIG=/etc/ferm.conf
+NAME=ferm
+DESC="firewall"
+
+test -x "${FERM}" || exit 0
+test -f "${CONFIG}" || exit 0
+
+# shellcheck disable=SC1091
+[ -r /etc/sysconfig/ferm ] && . /etc/sysconfig/ferm
+
+umask 0077
+
+FAST=${FAST:-yes}
+OPTIONS="${OPTIONS}"
+
+set -e
+
+# shellcheck disable=SC2086
+configure_ferm() {
+ if [ "${FAST}" = "yes" ]; then
+ ${FERM} ${OPTIONS} ${CONFIG} || return ${?}
+ else
+ ${FERM} ${OPTIONS} --slow ${CONFIG} || return ${?}
+ fi
+}
+
+case "${1}" in
+ start|reload|restart|force-reload)
+ # shellcheck disable=SC2039
+ echo -n "${1}ing ${DESC}" "${NAME}"
+ configure_ferm && echo " ... ok." || echo "... failed!"
+ ;;
+ stop)
+ # shellcheck disable=SC2039
+ echo -n "stopping ${DESC}" "${NAME}"
+ OPTIONS="${OPTIONS} --flush"
+ configure_ferm && echo " ... ok." || echo "... failed!"
+ ;;
+ *)
+ N=/etc/init.d/${NAME}
+ echo "Usage: ${N} {start|stop|restart|reload|force-reload}"
+ exit 1
+ ;;
+esac
+
+exit 0