diff options
-rw-r--r-- | conf.d.in/iptables.in | 1 | ||||
-rw-r--r-- | init.d.in/iptables.in | 33 |
2 files changed, 34 insertions, 0 deletions
diff --git a/conf.d.in/iptables.in b/conf.d.in/iptables.in new file mode 100644 index 0000000..ded05a4 --- /dev/null +++ b/conf.d.in/iptables.in @@ -0,0 +1 @@ +iptables_save="/etc/iptables/iptables.rules" diff --git a/init.d.in/iptables.in b/init.d.in/iptables.in new file mode 100644 index 0000000..397a9ae --- /dev/null +++ b/init.d.in/iptables.in @@ -0,0 +1,33 @@ +#!@OPENRC_RUN@ + +extra_commands="check" +extra_started_commands="reload" + +iptables_name="${SVCNAME}" +iptables="@BINDIR@/${iptables_name}" + +depend() { + need localmount + before net +} + +checkrules() { + ${iptables}-restore --test "${IPTABLES_SAVE}" +} + +start() { + checkrules || return 1 + ebegin "Loading ${iptables_name} with rules from ${IPTABLES_SAVE}" + ${iptables}-restore "${IPTABLES_SAVE}" + eend $? +} + +reload() { + start +} + +stop() { + ebegin "Flushing rules from ${iptables_name}" + /usr/lib/systemd/scripts/iptables-flush >/dev/null + eend $? +} |