diff options
author | David Phillips <david@sighup.nz> | 2017-09-17 21:45:59 +1200 |
---|---|---|
committer | David Phillips <david@sighup.nz> | 2017-09-17 21:45:59 +1200 |
commit | 6545dc1b51d13943016219e656fbc2b2946a5bc9 (patch) | |
tree | 794d82d2ef7f5a1b736bfc8239c52eefd3931e32 | |
parent | cb887a3bb28d483a145e4e77642b4b497a208772 (diff) | |
download | initscripts-6545dc1b51d13943016219e656fbc2b2946a5bc9.tar.xz |
Add starter iptables scripts
-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 $? +} |