Skip to content

Commit

Permalink
CLOUDSTACK-9437: Create egress chain on upgrade and cleanup for allow…
Browse files Browse the repository at this point in the history
… all traffic

- Ensure that FW_EGRESS_RULE chain exists after upgrading the router
- Flush allow all egress rule on 0.0.0.0/0, if such a rule exists in the config
  it will be added later (CLOUDSTACK-9437)
  • Loading branch information
swill committed Jul 25, 2016
1 parent 818063c commit d302269
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions systemvm/patches/debian/config/opt/cloud/bin/configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,12 @@ def create(self):
rstr = rstr.replace(" ", " ").lstrip()
self.fw.append([self.table, self.count, rstr])

def flushAllowAllEgressRules(self):
logging.debug("Flush allow 'all' egress firewall rule")
# Ensure that FW_EGRESS_RULES chain exists
CsHelper.execute("iptables-save | grep '^:FW_EGRESS_RULES' || iptables -t filter -N FW_EGRESS_RULES")
CsHelper.execute("iptables-save | grep '^-A FW_EGRESS_RULES -j ACCEPT$' | sed 's/^-A/iptables -t filter -D/g' | bash")

def process(self):
for item in self.dbag:
if item == "id":
Expand Down Expand Up @@ -978,6 +984,7 @@ def main(argv):
acls.process()

acls = CsAcl('firewallrules', config)
acls.flushAllowAllEgressRules()
acls.process()

fwd = CsForwardingRules("forwardingrules", config)
Expand Down

0 comments on commit d302269

Please sign in to comment.