#!/sbin/runscript
# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Id$
+# $Header: /var/cvsroot/gentoo-x86/net-firewall/iptables/files/iptables-1.4.13-r1.init,v 1.3 2013/04/27 17:29:09 vapier Exp $
extra_commands="check save panic"
extra_started_commands="reload"
#!/sbin/runscript
# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Id$
+# $Header: /var/cvsroot/gentoo-x86/net-firewall/iptables/files/iptables-1.4.13-r1.init,v 1.3 2013/04/27 17:29:09 vapier Exp $
extra_commands="check save panic"
extra_started_commands="reload"
--- /dev/null
+[Unit]
+Description=Save iptables firewall
+DefaultDependencies=no
+After=iptables.service
+# fail immediately if iptables.service has not been started
+Requisite=iptables.service
+Before=shutdown.target
+
+[Service]
+Type=oneshot
+RemainAfterExit=no
+ExecStart=/usr/local/lib/iptables-helper save
+
+[Install]
+WantedBy=shutdown.target
--- /dev/null
+/etc/systemd/system/iptables.service.d
\ No newline at end of file
--- /dev/null
+[Unit]
+Description=iptables firewall
+DefaultDependencies=false
+After=local-fs.target
+Before=basic.target
+# Note: shutdown is handled by iptables-save (if enabled)
+
+[Service]
+Type=oneshot
+RemainAfterExit=yes
+ExecStart=/usr/local/lib/iptables-helper start
+ExecReload=/usr/local/lib/iptables-helper reload
+ExecStop=/usr/local/lib/iptables-helper stop
+# Note: ExecRestart hasn't been implemented by systemd (yet)
+
+[Install]
+WantedBy=sysinit.target multi-user.target
+Also=iptables-save.service
--- /dev/null
+[Service]
+
+# Files from which to initialize the ip*tables rules.
+# Personally, I like to keep all rules in one directory
+#Environment="IPTABLES_INIT=/var/lib/iptables/init-IPv4.rules"
+#Environment="IP6TABLES_INIT=/var/lib/iptables/init-IPv6.rules"
+# But these are the OpenRC defaults:
+Environment="IPTABLES_INIT=/var/lib/iptables/rules-save"
+Environment="IP6TABLES_INIT=/var/lib/ip6tables/rules-save"
+
+# At system shutdown (or systemctl start iptables-save), current rules are
+# saved to the above files per default.
+# This "Save as" functionality is very usefull for development or hardened
+# production servers; it allows to inspect the saved rules before applying
+# them for the next start/reload.
+# If you prefer never to save the rules at all, simply specify /dev/null here.
+#Environment="IPTABLES_SAVE_AS=/var/lib/iptables/inspect-IPv4.rules"
+#Environment="IP6TABLES_SAVE_AS=/var/lib/iptables/inspect-IPv6.rules"
+
+# Save & restore the counters [yes|no]?
+Environment="COUNTERS=yes"