File tree Expand file tree Collapse file tree
systemvm/patches/debian/config Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -46,3 +46,16 @@ python /opt/cloud/bin/baremetal-vr.py &
4646
4747date > /var/cache/cloud/boot_up_done
4848logger -t cloud "Boot up process done"
49+
50+ #Restore the persistent iptables nat, rules and filters for IPv4 and IPv6 if they exist
51+ ipv4="/etc/iptables/router_rules.v4"
52+ if [ -e $ipv4 ]
53+ then
54+ iptables-restore < $ipv4
55+ fi
56+
57+ ipv6="/etc/iptables/router_rules.v6"
58+ if [ -e $ipv6 ]
59+ then
60+ iptables-restore < $ipv6
61+ fi
Original file line number Diff line number Diff line change @@ -676,6 +676,10 @@ def main(argv):
676676
677677 mon = CsMonitor ("monitorservice" , config )
678678 mon .process ()
679-
679+
680+ #Save iptables configuration - will be loaded on reboot by the iptables-restore that is configured on /etc/rc.local
681+ CsHelper .save_iptables ("iptables-save" , "/etc/iptables/router_rules.v4" )
682+ CsHelper .save_iptables ("ip6tables-save" , "/etc/iptables/router_rules.v6" )
683+
680684if __name__ == "__main__" :
681685 main (sys .argv )
Original file line number Diff line number Diff line change 1616# specific language governing permissions and limitations
1717# under the License.
1818""" General helper functions
19- for use in the configuation process
19+ for use in the configuration process
2020
2121"""
2222import subprocess
2727from netaddr import *
2828from pprint import pprint
2929
30-
3130def is_mounted (name ):
3231 for i in execute ("mount" ):
3332 vals = i .lstrip ().split ()
@@ -163,6 +162,19 @@ def execute(command):
163162 return result .splitlines ()
164163
165164
165+ def save_iptables (command , iptables_file ):
166+ """ Execute command """
167+ logging .debug ("Saving iptables for %s" % command )
168+
169+ result = execute (command )
170+ fIptables = open (iptables_file , "w+" )
171+
172+ for line in result :
173+ fIptables .write (line )
174+ fIptables .write ("\n " )
175+ fIptables .close ()
176+
177+
166178def execute2 (command ):
167179 """ Execute command """
168180 logging .debug ("Executing %s" % command )
You can’t perform that action at this time.
0 commit comments