]> Frank Brehm's Git Trees - scripts/root-bin.git/commitdiff
Initial revision
authorroot <empty>
Mon, 25 Dec 2006 13:13:37 +0000 (13:13 +0000)
committerroot <empty>
Mon, 25 Dec 2006 13:13:37 +0000 (13:13 +0000)
rotate_iptables.sh [new file with mode: 0644]

diff --git a/rotate_iptables.sh b/rotate_iptables.sh
new file mode 100644 (file)
index 0000000..62993ba
--- /dev/null
@@ -0,0 +1,42 @@
+#!/bin/sh
+
+export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/root/bin
+
+echo
+echo "Rotiere IP-Tables-Zählerstände"
+echo
+
+TABLES=$( cat /proc/net/ip_tables_names )
+SAVE=/var/lib/iptables/save.$(date +'%F_%H-%M-%S').txt
+
+echo "Sicherung erfolgt in '$SAVE' ..."
+
+echo "#############################################################" >>$SAVE
+echo "# Rotierung der IP-Tables-Zählerstände"                        >>$SAVE
+echo "#    $(date)"                                                  >>$SAVE
+echo "#############################################################" >>$SAVE
+
+for table in $TABLES ; do
+
+  echo
+  echo "Setze Tabelle '$table' zurück ..."
+  echo >>$SAVE
+  echo "#------------------------------------------------------------" >>$SAVE
+  echo >>$SAVE
+  echo "Tabelle '$table'" >>$SAVE
+  echo >>$SAVE
+  iptables -t $table -L -Z -vnx >>$SAVE
+
+done
+
+echo >>$SAVE
+echo "#############################################################" >>$SAVE
+echo >>$SAVE
+if [ -x /etc/init.d/iptables ] ; then
+  /etc/init.d/iptables save >>$SAVE
+fi
+echo >>$SAVE
+
+echo
+echo "Rotieren beendet"
+