[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[PATCH rhel5-branch] Allow blocking the ssh port through kickstart (#485086).



---
 installclass.py |    7 +++++--
 kickstart.py    |    2 +-
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/installclass.py b/installclass.py
index 9a34363..36665cf 100644
--- a/installclass.py
+++ b/installclass.py
@@ -305,13 +305,16 @@ class BaseInstallClass:
     def setSELinux(self, id, sel):
         id.security.setSELinux(sel)
 
-    def setFirewall(self, id, enable = 1, trusts = [], ports = []):
+    def setFirewall(self, id, enable = 1, trusts = [], ports = [], disableSsh = False):
 	id.firewall.enabled = enable
 	id.firewall.trustdevs = trusts
 
 	for port in ports:
 	    id.firewall.portlist.append (port)
-        
+
+        if disableSsh:
+            id.firewall.portlist.remove("22:tcp")
+
     def setMiscXSettings(self, id, depth = None, resolution = None,
                          desktop = None, runlevel = None):
 
diff --git a/kickstart.py b/kickstart.py
index 46c6c1f..5f40e61 100644
--- a/kickstart.py
+++ b/kickstart.py
@@ -197,7 +197,7 @@ class AnacondaKSHandlers(KickstartHandlers):
         KickstartHandlers.doFirewall(self, args)
         dict = self.ksdata.firewall
 	self.id.instClass.setFirewall(self.id, dict["enabled"], dict["trusts"],
-                                      dict["ports"])
+                                      dict["ports"], disableSsh=dict["disableSsh"])
 
     def doFirstboot(self, args):
         KickstartHandlers.doFirstboot(self, args)
-- 
1.7.4.1


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]