summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--installclass.py14
-rw-r--r--kickstart.py47
-rw-r--r--todo.py26
3 files changed, 80 insertions, 7 deletions
diff --git a/installclass.py b/installclass.py
index ffede2fe0..9c25d0f2e 100644
--- a/installclass.py
+++ b/installclass.py
@@ -103,7 +103,7 @@ class BaseInstallClass:
def addToSkipList(self, type):
# this throws an exception if there is a problem
- [ "lilo", "mouse", "network", "authentication", "complete", "complete",
+ [ "lilo", "mouse", "network", "firewall", "authentication", "complete", "complete",
"package-selection", "bootdisk", "partition", "format", "timezone",
"accounts", "dependencies", "language", "keyboard", "xconfig",
"welcome", "custom-upgrade", "installtype", "mouse",
@@ -115,7 +115,16 @@ class BaseInstallClass:
def getHostname(self):
return self.hostname
-
+
+ def setFirewall(self, enable = -1, policy = 0, trusts = [], ports = "",
+ dhcp = 0, ssh = 0, telnet = 0, smtp = 0, http = 0,
+ ftp = 0):
+ self.firewall = (enable, policy, trusts, ports, dhcp, ssh, telnet,
+ smtp, http, ftp)
+
+ def getFirewall(self):
+ return self.firewall
+
def setAuthentication(self, useShadow, useMd5,
useNIS = 0, nisDomain = "", nisBroadcast = 0,
nisServer = "",
@@ -244,6 +253,7 @@ class BaseInstallClass:
self.packages = None
self.makeBootdisk = 0
self.timezone = None
+ self.setFirewall()
self.setAuthentication(1, 1, 0)
self.rootPassword = None
self.rootPasswordCrypted = 0
diff --git a/kickstart.py b/kickstart.py
index 60f4fea9f..8063593f0 100644
--- a/kickstart.py
+++ b/kickstart.py
@@ -60,7 +60,51 @@ class KickstartBase(BaseInstallClass):
BaseInstallClass.doRootPw(self, extra[0], isCrypted = isCrypted)
self.addToSkipList("accounts")
-
+
+ def doFirewall(self, args):
+ (args, extra) = isys.getopt(args, '',
+ [ 'dhcp', 'ssh', 'telnet', 'smtp', 'http', 'ftp',
+ 'port=', 'policy=', 'trust=' ])
+
+ dhcp = 0
+ ssh = 0
+ telnet = 0
+ smtp = 0
+ http = 0
+ ftp = 0
+ policy = 0
+ enable = 1
+ trusts = []
+ ports = None
+
+ for n in args:
+ (str, arg) = n
+ if str == '--dhcp':
+ dhcp = 1
+ elif str == '--ssh':
+ ssh = 1
+ elif str == '--telnet':
+ telnet = 1
+ elif str == '--smtp':
+ smtp = 1
+ elif str == '--http':
+ http = 1
+ elif str == '--ftp':
+ ftp = 1
+ elif str == '--policy':
+ policy = arg
+ elif str == '--trust':
+ trusts.append(arg)
+ elif str == '--port':
+ if ports:
+ ports = '%s %s' % (ports, arg)
+ else:
+ ports = arg
+
+ self.setFirewall(enable, policy, trusts, ports, dhcp, ssh, telnet,
+ smtp, http, ftp)
+ self.addToSkipList("firewall")
+
def doAuthconfig(self, args):
(args, extra) = isys.getopt(args, '',
[ 'useshadow',
@@ -353,6 +397,7 @@ class KickstartBase(BaseInstallClass):
"device" : None ,
"deviceprobe" : None ,
"driverdisk" : None ,
+ "firewall" : self.doFirewall ,
"harddrive" : None ,
"install" : self.doInstall ,
"keyboard" : self.doKeyboard ,
diff --git a/todo.py b/todo.py
index 315e176b3..0d0b98e71 100644
--- a/todo.py
+++ b/todo.py
@@ -738,11 +738,11 @@ class ToDo:
"--policy", self.firewall.policy ]
if self.firewall.dhcp:
args.append ("--dhcp")
- if portlist:
- ports = string.split(portlist,',')
+ if self.firewall.portlist:
+ ports = string.split(self.firewall.portlist,',')
for port in ports:
port = string.strip(port)
- if not port.index(':'):
+ if not string.index(port,':'):
port = '%s:tcp' % port
self.firewall.ports.append(port)
for port in self.firewall.ports:
@@ -759,7 +759,9 @@ class ToDo:
args.append ("--telnet")
for dev in self.firewall.trustdevs:
args.append ("--trust", dev)
- #iutil.execWithRedirect(args[0], args, root = self.instPath,
+ if self.firewall.enabled > 0:
+ pass
+ # iutil.execWithRedirect(args[0], args, root = self.instPath,
# stdout = None, stderr = None)
def setupAuthentication (self):
@@ -1165,11 +1167,26 @@ class ToDo:
todo.instClass = instClass
todo.hostname = todo.instClass.getHostname()
todo.updateInstClassComps()
+ ( enable, policy, trusts, ports, dhcp, ssh,
+ telnet, smtp, http, ftp ) = todo.instClass.getFirewall()
+
+ todo.firewall.enabled = enable
+ todo.firewall.policy = policy
+ todo.firewall.trustdevs = trusts
+ todo.firewall.portlist = ports
+ todo.firewall.dhcp = dhcp
+ todo.firewall.ssh = ssh
+ todo.firewall.telnet = telnet
+ todo.firewall.smtp = smtp
+ todo.firewall.http = http
+ todo.firewall.ftp = ftp
+
( useShadow, useMd5,
useNIS, nisDomain, nisBroadcast, nisServer,
useLdap, useLdapauth, ldapServer, ldapBasedn,
useKrb5, krb5Realm, krb5Kdc, krb5Admin,
useHesiod, hesiodLhs, hesiodRhs) = todo.instClass.getAuthentication()
+
todo.auth.useShadow = useShadow
todo.auth.useMD5 = useMd5
todo.auth.useNIS = useNIS
@@ -1530,6 +1547,7 @@ class ToDo:
self.writeKeyboard ()
self.writeNetworkConfig ()
self.setupAuthentication ()
+ self.setupFirewall ()
self.writeRootPassword ()
self.createAccounts ()