[PATCH] Add support for removing removing services from the firewall (#957809)

Martin Kolman mkolman at redhat.com
Fri Oct 4 16:07:05 UTC 2013


Add support for removing services, that were enabled on the firewall.
This also makes it possible to disable services that are enabled on
the firewall by default, such as dhcpv6-client, mdns or ssh.
Services that are not enabled but are requested for removal are ignored.

Signed-off-by: Martin Kolman <mkolman at redhat.com>
---
 pyanaconda/kickstart.py | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/pyanaconda/kickstart.py b/pyanaconda/kickstart.py
index 34929b9..df874f7 100644
--- a/pyanaconda/kickstart.py
+++ b/pyanaconda/kickstart.py
@@ -501,7 +501,7 @@ class Fcoe(commands.fcoe.F13_Fcoe):
 
         return fc
 
-class Firewall(commands.firewall.F14_Firewall):
+class Firewall(commands.firewall.F20_Firewall):
     def execute(self, storage, ksdata, instClass):
         args = []
         # enabled is None if neither --enable or --disable is passed
@@ -511,7 +511,8 @@ class Firewall(commands.firewall.F14_Firewall):
         else:
             args += ["--enabled"]
 
-        if not "ssh" in self.services and not "22:tcp" in self.ports:
+        if "ssh" not in self.services and "ssh" not in self.remove_services \
+            and "22:tcp" not in self.ports:
             args += ["--service=ssh"]
 
         for dev in self.trusts:
@@ -520,6 +521,9 @@ class Firewall(commands.firewall.F14_Firewall):
         for port in self.ports:
             args += [ "--port=%s" % (port,) ]
 
+        for remove_service in self.remove_services:
+            args += ["--remove-service=%s" % remove_service]
+
         for service in self.services:
             args += [ "--service=%s" % (service,) ]
 
-- 
1.8.3.1



More information about the anaconda-patches mailing list