Skip to content

Commit 6e5d5c3

Browse files
author
Jayapal
committed
CLOUDSTACK-8891: Fixed default iptables rules on VR for guest traffic
1 parent 3f6b311 commit 6e5d5c3

File tree

3 files changed

+21
-4
lines changed

3 files changed

+21
-4
lines changed

systemvm/patches/debian/config/opt/cloud/bin/configure.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -818,51 +818,66 @@ def main(argv):
818818
format=config.get_format())
819819
config.set_address()
820820

821+
logging.debug("Configuring ip addresses")
821822
# IP configuration
822823
config.address().compare()
823824
config.address().process()
824825

826+
logging.debug("Configuring vmpassword")
825827
password = CsPassword("vmpassword", config)
826828
password.process()
827829

830+
logging.debug("Configuring vmdata")
828831
metadata = CsVmMetadata('vmdata', config)
829832
metadata.process()
830833

834+
logging.debug("Configuring networkacl")
831835
acls = CsAcl('networkacl', config)
832836
acls.process()
833837

838+
logging.debug("Configuring firewall rules")
834839
acls = CsAcl('firewallrules', config)
835840
acls.process()
836841

842+
logging.debug("Configuring PF rules")
837843
fwd = CsForwardingRules("forwardingrules", config)
838844
fwd.process()
839845

840846
red = CsRedundant(config)
841847
red.set()
842848

849+
logging.debug("Configuring s2s vpn")
843850
vpns = CsSite2SiteVpn("site2sitevpn", config)
844851
vpns.process()
845852

853+
logging.debug("Configuring remote access vpn")
846854
#remote access vpn
847855
rvpn = CsRemoteAccessVpn("remoteaccessvpn", config)
848856
rvpn.process()
849857

858+
logging.debug("Configuring vpn users list")
850859
#remote access vpn users
851860
vpnuser = CsVpnUser("vpnuserlist", config)
852861
vpnuser.process()
853862

863+
logging.debug("Configuring dhcp entry")
854864
dhcp = CsDhcp("dhcpentry", config)
855865
dhcp.process()
856866

867+
logging.debug("Configuring load balancer")
857868
lb = CsLoadBalancer("loadbalancer", config)
858869
lb.process()
859870

871+
logging.debug("Configuring monitor service")
860872
mon = CsMonitor("monitorservice", config)
861873
mon.process()
862874

875+
logging.debug("Configuring iptables rules .....")
863876
nf = CsNetfilters()
864877
nf.compare(config.get_fw())
865878

879+
logging.debug("Configuring iptables rules done ...saving rules")
880+
866881
# Save iptables configuration - will be loaded on reboot by the iptables-restore that is configured on /etc/rc.local
867882
CsHelper.save_iptables("iptables-save", "/etc/iptables/router_rules.v4")
868883
CsHelper.save_iptables("ip6tables-save", "/etc/iptables/router_rules.v6")

systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,8 @@ def process(self):
121121
ip = CsIP(dev, self.config)
122122

123123
for address in self.dbag[dev]:
124-
if(address["nw_type"]!="public"):
125-
continue
124+
# if(address["nw_type"]!="public"):
125+
# continue
126126

127127
#check if link is up
128128
if (not self.check_if_link_exists(dev)):

systemvm/patches/debian/config/opt/cloud/bin/cs/CsNetfilter.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ def get_unseen(self):
126126
del_list = [x for x in self.rules if x.unseen()]
127127
for r in del_list:
128128
cmd = "iptables -t %s %s" % (r.get_table(), r.to_str(True))
129+
logging.debug("unseen cmd: %s ", cmd)
129130
CsHelper.execute(cmd)
130131
# print "Delete rule %s from table %s" % (r.to_str(True), r.get_table())
131132
logging.info("Delete rule %s from table %s", r.to_str(True), r.get_table())
@@ -150,10 +151,10 @@ def compare(self, list):
150151
if isinstance(fw[1], int):
151152
new_rule.set_count(fw[1])
152153
if self.has_rule(new_rule):
153-
logging.debug("rule %s exists in table %s", fw[2], new_rule.get_table())
154+
logging.debug("Exists: rule=%s table=%s", fw[2], new_rule.get_table())
154155
else:
155156
# print "Add rule %s in table %s" % ( fw[2], new_rule.get_table())
156-
logging.info("Add rule %s in table %s", fw[2], new_rule.get_table())
157+
logging.info("Add: rule=%s table=%s", fw[2], new_rule.get_table())
157158
# front means insert instead of append
158159
cpy = fw[2]
159160
if fw[1] == "front":
@@ -185,6 +186,7 @@ def del_standard(self):
185186
if i.startswith('-A'): # Rule
186187
self.del_rule(table, i.strip())
187188
except IOError:
189+
logging.debug("Exception in del_standard, returning")
188190
# Nothing can be done
189191
return
190192

0 commit comments

Comments
 (0)