]> git.somenet.org - ctf/pub/network.git/blob - xtable_apply.sh
GITOLITE.txt
[ctf/pub/network.git] / xtable_apply.sh
1 #!/bin/bash
2 #
3 # Copyright 2013-2016 by Jan Vales <jan@jvales.net> (Someone <someone@somenet.org>)
4 # send me your changes. credit author(s). do not publish. share alike.
5 # to be done: find a suitable licence text.
6 #
7 # Script to apply new xtable rules.
8 #
9
10 cat iptables.rules.* > iptables.new.tmp
11
12 /sbin/iptables-save > iptables.old.tmp
13
14 echo "applying new rules ..."
15 /sbin/iptables-restore < iptables.new.tmp
16 mkdir -p /media/sf_vmshare/_orga/read_only_info
17 cat iptables.new.tmp > /media/sf_vmshare/_orga/read_only_info/iptables.rules
18 rm iptables.new.tmp
19 echo -e "APPLIED!\n"
20
21 echo "LOCK-OUT-PREVENTION will revert to old rules in 30 sec. ctrl + c to abort."
22 echo "ctrl + c to abort."
23 sleep 30
24
25 echo "reverting to old rules ..."
26 /sbin/iptables-restore < iptables.old.tmp
27 cat iptables.old.tmp > /media/sf_vmshare/_orga/read_only_info/iptable.rules
28 rm iptables.old.tmp
29 echo "REVERTED!"