summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Lange <code@nerdmind.de>2016-03-09 01:07:10 +0100
committerThomas Lange <code@nerdmind.de>2016-03-09 01:07:10 +0100
commitd73b478a9e9c37e7d6eebc52c803eafa92ffaf58 (patch)
tree491b84a6bd24eae9bfb2cfbe3b5d39d47dec40c2
parentc0be35a6c5c9aed70ab101c88ff761397fc56b3b (diff)
downloadsnippets-d73b478a9e9c37e7d6eebc52c803eafa92ffaf58.tar.gz
snippets-d73b478a9e9c37e7d6eebc52c803eafa92ffaf58.tar.xz
snippets-d73b478a9e9c37e7d6eebc52c803eafa92ffaf58.zip
IPTables-save added
-rwxr-xr-xBash/iptables-whiteblacklisting.sh14
1 files changed, 13 insertions, 1 deletions
diff --git a/Bash/iptables-whiteblacklisting.sh b/Bash/iptables-whiteblacklisting.sh
index a34757d..530c801 100755
--- a/Bash/iptables-whiteblacklisting.sh
+++ b/Bash/iptables-whiteblacklisting.sh
@@ -44,6 +44,12 @@ IPTABLES_V4=`which iptables`
IPTABLES_V6=`which ip6tables`
#===============================================================================
+# Define IPTables-save commands for IPv4 and IPv6
+#===============================================================================
+IPTABLES_SAVE_V4=`which iptables-save`
+IPTABLES_SAVE_V6=`which ip6tables-save`
+
+#===============================================================================
# Wrapper function for IPTables with IPv4 and IPv6
#===============================================================================
IPTABLES() {
@@ -135,4 +141,10 @@ fi
# ADDITIONAL RULES
#===============================================================================
${IPTABLES_V4} --append INPUT --source 192.168.1.0/24 --jump ACCEPT
-${IPTABLES_V6} --append INPUT --source fe80::/64 --jump ACCEPT \ No newline at end of file
+${IPTABLES_V6} --append INPUT --source fe80::/64 --jump ACCEPT
+
+#===============================================================================
+# Save IPTables configuration permanent
+#===============================================================================
+if [ ${IPTABLES_SAVE_V4} ]; then ${IPTABLES_SAVE_V4} > /etc/iptables/rules.v4; fi
+if [ ${IPTABLES_SAVE_V6} ]; then ${IPTABLES_SAVE_V6} > /etc/iptables/rules.v6; fi \ No newline at end of file