Skip to content

Commit 5b4628f

Browse files
committed
remove the default FORWARD rule on CentOS 5
1 parent 399c1ad commit 5b4628f

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

python/lib/cloudutils/serviceConfig.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -489,6 +489,7 @@ class firewallConfigBase(serviceCfgBase):
489489
def __init__(self, syscfg):
490490
super(firewallConfigBase, self).__init__(syscfg)
491491
self.serviceName = "Firewall"
492+
self.rules = []
492493

493494
def allowPort(self, port):
494495
status = False
@@ -504,7 +505,10 @@ def config(self):
504505
try:
505506
for port in self.ports:
506507
self.allowPort(port)
507-
508+
509+
for rule in self.rules:
510+
bash("iptables " + rule)
511+
508512
bash("iptables-save > /etc/sysconfig/iptables")
509513
self.syscfg.svo.stopService("iptables")
510514
self.syscfg.svo.startService("iptables")
@@ -519,7 +523,8 @@ class firewallConfigAgent(firewallConfigBase):
519523
def __init__(self, syscfg):
520524
super(firewallConfigAgent, self).__init__(syscfg)
521525
self.ports = "22 16509 5900:6100 49152:49216".split()
522-
526+
if syscfg.env.distribution.getVersion() == "CentOS":
527+
self.rules = ["-D FORWARD -j RH-Firewall-1-INPUT"]
523528

524529

525530
class cloudAgentConfig(serviceCfgBase):

0 commit comments

Comments
 (0)