summaryrefslogtreecommitdiffstats
path: root/textw
diff options
context:
space:
mode:
authorBill Nottingham <notting@redhat.com>2001-01-08 17:08:19 +0000
committerBill Nottingham <notting@redhat.com>2001-01-08 17:08:19 +0000
commit285236f661da5ddc5d8a761e32255460e5656378 (patch)
treeee9113f11bedbb42941320336648d5be95088eb1 /textw
parentfde523c1bb77889c3c376e40276e7197acaf98c0 (diff)
downloadanaconda-285236f661da5ddc5d8a761e32255460e5656378.tar.gz
anaconda-285236f661da5ddc5d8a761e32255460e5656378.tar.xz
anaconda-285236f661da5ddc5d8a761e32255460e5656378.zip
land tui firewall stuff
Diffstat (limited to 'textw')
-rw-r--r--textw/firewall_text.py118
1 files changed, 56 insertions, 62 deletions
diff --git a/textw/firewall_text.py b/textw/firewall_text.py
index f59c67093..ac0e2b5f1 100644
--- a/textw/firewall_text.py
+++ b/textw/firewall_text.py
@@ -6,13 +6,7 @@ import iutil
class FirewallWindow:
def __call__(self, screen, todo):
- instType = todo.instClass.installType
- if instType == "custom" or todo.expert or instType == "server":
- detail = 1
- else:
- detail = 0
-
- bb = ButtonBar (screen, ((_("OK"), "ok"), (_("Back"), "back")))
+ bb = ButtonBar (screen, ((_("OK"), "ok"), (_("Customize"), "customize"), (_("Back"), "back")))
toplevel = GridFormHelp (screen, _("Firewall Configuration"),
"firewall", 1, 5)
@@ -22,16 +16,18 @@ class FirewallWindow:
"to system services (such as telnet or printing), "
"but allows other connections. No firewall allows "
"all connections and is not recommended. ")
- toplevel.add (TextboxReflowed(65, text), 0, 0, (0, 0, 0, 1))
+ toplevel.add (TextboxReflowed(50, text), 0, 0, (0, 0, 0, 1))
toplevel.add (bb, 0, 4, (0, 0, 0, 0), growx = 1)
+ smallGrid = Grid(2,1)
+
bigGrid = Grid(2,15)
typeGrid = Grid(3,2)
label = Label(_("Security Level:"))
- bigGrid.setField (label, 0, 0, (0, 0, 0, 1), anchorLeft = 1)
+ smallGrid.setField (label, 0, 0, (0, 0, 0, 1), anchorLeft = 1)
self.paranoid = SingleRadioButton(_("High"), None, todo.firewall.enabled and not todo.firewall.policy)
@@ -44,11 +40,7 @@ class FirewallWindow:
self.disabled.setCallback(self.radiocb, (todo, self.disabled))
typeGrid.setField (self.disabled, 2, 0, (0, 0, 1, 0), anchorLeft = 1)
- self.customize = Checkbox(_("Customize"), detail)
- self.customize.setCallback(self.customcb, (todo, self.customize))
- typeGrid.setField (self.customize, 0, 1, (0, 0, 1, 0), anchorLeft = 1)
-
- bigGrid.setField(typeGrid, 1, 0, (1, 0, 0, 1), anchorLeft = 1)
+ smallGrid.setField (typeGrid, 1, 0, (1, 0, 0, 1), anchorLeft = 1)
currentRow = 1
devices = todo.network.available().keys()
@@ -80,48 +72,80 @@ class FirewallWindow:
bigGrid.setField (self.devGrid, 1, currentRow, (1, 0, 0, 1), anchorLeft = 1)
currentRow = currentRow + 1
- bigGrid.setField (Label(_("Allow incoming:")), 0, currentRow, (0, 0, 0, 1),
+ bigGrid.setField (Label(_("Allow incoming:")), 0, currentRow, (0, 0, 0, 0),
anchorTop = 1)
- self.portGrid = Grid(2,4)
+ self.portGrid = Grid(3,2)
self.dhcp = Checkbox (_("DHCP"), todo.firewall.dhcp)
self.portGrid.setField (self.dhcp, 0, 0, (0, 0, 1, 0), anchorLeft = 1)
- self.ssh = Checkbox (_("SSH (Secure Shell)"), todo.firewall.ssh)
+ self.ssh = Checkbox (_("SSH"), todo.firewall.ssh)
self.portGrid.setField (self.ssh, 1, 0, (0, 0, 1, 0), anchorLeft = 1)
self.telnet = Checkbox (_("Telnet"), todo.firewall.telnet)
- self.portGrid.setField (self.telnet, 0, 1, (0, 0, 1, 0), anchorLeft = 1)
+ self.portGrid.setField (self.telnet, 2, 0, (0, 0, 1, 0), anchorLeft = 1)
self.http = Checkbox (_("WWW (HTTP)"), todo.firewall.http)
- self.portGrid.setField (self.http, 1, 1, (0, 0, 1, 0), anchorLeft = 1)
+ self.portGrid.setField (self.http, 0, 1, (0, 0, 1, 0), anchorLeft = 1)
self.smtp = Checkbox (_("Mail (SMTP)"), todo.firewall.smtp)
- self.portGrid.setField (self.smtp, 0, 2, (0, 0, 1, 0), anchorLeft = 1)
+ self.portGrid.setField (self.smtp, 1, 1, (0, 0, 1, 0), anchorLeft = 1)
self.ftp = Checkbox (_("FTP"), todo.firewall.ftp)
- self.portGrid.setField (self.ftp, 1, 2, (0, 0, 1, 0), anchorLeft = 1)
+ self.portGrid.setField (self.ftp, 2, 1, (0, 0, 1, 0), anchorLeft = 1)
- self.portGrid.setField (Label(_("Other ports")), 0, 3, (0, 0, 1, 0), anchorLeft = 1)
+ oGrid = Grid(2,1)
+ oGrid.setField (Label(_("Other ports")), 0, 0, (0, 0, 1, 0), anchorLeft = 1)
self.other = Entry (25, todo.firewall.portlist)
- self.portGrid.setField (self.other, 1, 3, (0, 0, 1, 0), anchorLeft = 1)
-
- bigGrid.setField (self.portGrid, 1, currentRow, (1, 0, 0, 1), anchorLeft = 1)
+ oGrid.setField (self.other, 1, 0, (0, 0, 1, 0), anchorLeft = 1, growx = 1)
+ bigGrid.setField (self.portGrid, 1, currentRow, (1, 0, 0, 0), anchorLeft = 1)
+ bigGrid.setField (Label(""), 0, currentRow + 1, (0, 0, 0, 1), anchorLeft = 1)
+ bigGrid.setField (oGrid, 1, currentRow + 1, (1, 0, 0, 1), anchorLeft = 1)
self.portboxes = ( self.ssh, self.telnet, self.http, self.smtp, self.ftp,
self.other )
- toplevel.add(bigGrid, 0, 1, (0, 0, 0, 0), anchorLeft = 1)
+ toplevel.add(smallGrid, 0, 1, (0, 0, 0, 0), anchorLeft = 1)
if self.disabled.selected():
self.radiocb((todo, self.disabled))
- self.customcb((todo, self.customize))
- result = toplevel.runOnce ()
- rc = bb.buttonPressed (result)
+ while 1:
+ result = toplevel.run ()
+
+ rc = bb.buttonPressed (result)
- if rc == "back":
- return INSTALL_BACK
+ if rc == "back":
+ screen.popWindow()
+ return INSTALL_BACK
+ if rc == "customize":
+
+ if self.disabled.selected():
+ ButtonChoiceWindow(screen, _("Invalid Choice"),
+ _("You cannot customize a disabled firewall."),
+ buttons = [ _("OK") ], width = 40)
+ else:
+ popbb = ButtonBar (screen, ((_("OK"), "ok"),))
+
+ poplevel = GridFormHelp (screen, _("Firewall Configuration - Customize"),
+ "firewall-custom", 1, 5)
+ text = _("You can customize your firewall in two ways. "
+ "First, you can select to allow all traffic from "
+ "certain network interfaces. Second, you can allow "
+ "certain protocols explicitly through the firewall. "
+ "Specify additional ports in the form 'service:protocol', "
+ "such as 'imap:tcp'. ")
+
+ poplevel.add (TextboxReflowed(65, text), 0, 0, (0, 0, 0, 1))
+
+ poplevel.add (popbb, 0, 4, (0, 0, 0, 0), growx = 1)
+ poplevel.add (bigGrid, 0, 1, (0, 0, 0, 0), anchorLeft = 1)
+
+ result = poplevel.run()
+ screen.popWindow()
+
+ if rc == "ok":
+ break
+ screen.popWindow()
for device in self.netCBs.keys():
if self.netCBs[device].selected():
todo.firewall.trustdevs.append(device)
- print todo.firewall.trustdevs
todo.firewall.portlist = self.other.value()
todo.firewall.dhcp = self.dhcp.selected()
todo.firewall.ssh = self.ssh.selected()
@@ -139,44 +163,14 @@ class FirewallWindow:
todo.firewall.policy = 1
return INSTALL_OK
- def customcb(self, args):
- (todo, wigdet) = args
- if self.customize.selected():
- flag = FLAGS_RESET
- else:
- flag = FLAGS_SET
- self.dhcp.setFlags(FLAG_DISABLED, flag)
- for cb in self.portboxes:
- cb.setFlags(FLAG_DISABLED, flag)
- for cb in self.netCBs.values():
- cb.setFlags(FLAG_DISABLED, flag)
-
def radiocb(self, args):
(todo, widget) = args
if widget == self.disabled:
todo.firewall.enabled = 0
- self.customize.setFlags(FLAG_DISABLED, FLAGS_SET)
- for cb in self.portboxes:
- cb.setFlags(FLAG_DISABLED, FLAGS_SET)
- for cb in self.netCBs.values():
- cb.setFlags(FLAG_DISABLED, FLAGS_SET)
- self.dhcp.setFlags(FLAG_DISABLED, FLAGS_SET)
elif widget == self.simple:
todo.firewall.policy = 1
- for cb in self.portboxes:
- cb.setFlags(FLAG_DISABLED, FLAGS_RESET)
- for cb in self.netCBs.values():
- cb.setFlags(FLAG_DISABLED, FLAGS_RESET)
- self.customize.setFlags(FLAG_DISABLED, FLAGS_RESET)
- self.dhcp.setFlags(FLAG_DISABLED, FLAGS_RESET)
elif widget == self.paranoid:
todo.firewall.policy = 0
- for cb in self.portboxes:
- cb.setFlags(FLAG_DISABLED, FLAGS_RESET)
- for cb in self.netCBs.values():
- cb.setFlags(FLAG_DISABLED, FLAGS_RESET)
- self.customize.setFlags(FLAG_DISABLED, FLAGS_RESET)
- self.dhcp.setFlags(FLAG_DISABLED, FLAGS_RESET)
else:
raise RuntimeError, "never reached"