Module: Yast::SecurityDialogsInclude
- Defined in:
- ../../src/include/security/dialogs.rb
Instance Method Summary (collapse)
-
- (Object) BootDialog
Boot dialog.
- - (Object) DisplayHelpPopup(help_id)
- - (Object) initialize_security_dialogs(include_target)
-
- (Object) LoginDialog
Login dialog.
-
- (Object) MiscDialog
Misc dialog.
- - (Object) OverviewDialog
- - (Object) OverviewText(type)
-
- (Object) PassDialog
Password dialog.
- - (Object) SecurityStatus(option, plaintext)
Instance Method Details
- (Object) BootDialog
Boot dialog
644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 |
# File '../../src/include/security/dialogs.rb', line 644 def BootDialog # Boot dialog caption caption = _("Boot Settings") help = Ops.get_string(@HELPS, "boot", "") # Boot dialog contents contents = HVCenter( HVSquash( HBox( HSpacing(5), VBox( VSpacing(2), # Frame label Frame( _("Boot Permissions"), HBox( HSpacing(3), VBox( VSpacing(1), ("CONSOLE_SHUTDOWN"), VSpacing(1.0), ("DISPLAYMANAGER_SHUTDOWN"), VSpacing(1.0), ("HIBERNATE_SYSTEM"), VSpacing(1) ), HSpacing(3) ) ), VSpacing(2) ), HSpacing(5) ) ) ) Wizard.SetContentsButtons( caption, contents, help, Label.BackButton, Label.OKButton ) Wizard.HideBackButton Wizard.SetAbortButton(:abort, Label.CancelButton) # select the dialog in the tree navigation Wizard.SelectTreeItem("boot") ret = nil while true ret = UI.UserInput # abort? if ret == :abort || ret == :cancel if ReallyAbort() break else next end elsif ret == :back || ret == :next || Builtins.contains(@tree_dialogs, ret) # the current item has been selected, do not change to the same dialog if ret == "boot" # preselect the item if it has been unselected Wizard.SelectTreeItem("boot") if Wizard.QueryTreeItem != "boot" next end break else Builtins.y2error("Unexpected return code: %1", ret) next end end if ret == :next || Builtins.contains(@tree_dialogs, ret) ("CONSOLE_SHUTDOWN") ("DISPLAYMANAGER_SHUTDOWN") ("HIBERNATE_SYSTEM") end deep_copy(ret) end |
- (Object) DisplayHelpPopup(help_id)
387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 |
# File '../../src/include/security/dialogs.rb', line 387 def DisplayHelpPopup(help_id) help = Ops.get(@help_mapping, help_id, "") # add the warning if the option is unknown if SecurityStatus(help_id, true) == @UNKNOWN_STATUS help = Ops.add(help, Ops.get_string(@HELPS, "unknown_status", "")) end # add extra help to service related options if help_id == "RUNLEVEL3_MANDATORY_SERVICES" || help_id == "RUNLEVEL5_MANDATORY_SERVICES" runlevel = help_id == "RUNLEVEL3_MANDATORY_SERVICES" ? 3 : 5 missing = Security.MissingMandatoryServices(runlevel) if missing != nil && missing != [] srvs = "" Builtins.foreach(missing) do |l| # this is a separator between service names # e.g.: "postfix" + " or " + "sendmail" group = Builtins.mergestring(l, _(" or ")) srvs = Ops.add(Ops.add(srvs, group), "<BR>") end # richtext message: %1 = runlevel ("3" or "5"), %2 = list of services help = Ops.add( help, Builtins.sformat( _( "<P>These basic system services are not enabled in runlevel %1:<BR><B>%2</B></P>" ), runlevel, srvs ) ) else help = Ops.add(help, _("<P>All basic services are enabled.</P>")) end elsif help_id == "RUNLEVEL3_EXTRA_SERVICES" || help_id == "RUNLEVEL5_EXTRA_SERVICES" runlevel = help_id == "RUNLEVEL3_EXTRA_SERVICES" ? 3 : 5 extra = Security.ExtraServices(runlevel) if extra != nil && extra != [] srvs = Builtins.mergestring(extra, "<BR>") help = Ops.add( help, Builtins.sformat( _( "<P>These extra services are enabled in runlevel %1:<BR><B>%2</B></P>" ), runlevel, srvs ) ) help = Ops.add( help, _( "<P>Check the list of services and disable all unused services.</P>" ) ) else help = Ops.add( help, _("<P>Only basic system services are enabled.</P>") ) end end if help != nil && help != "" Popup.LongText( Ops.get(@label_mapping, help_id, _("Description")), RichText(help), 70, 15 ) end nil end |
- (Object) initialize_security_dialogs(include_target)
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 |
# File '../../src/include/security/dialogs.rb', line 30 def initialize_security_dialogs(include_target) Yast.import "UI" textdomain "security" Yast.import "Label" Yast.import "Popup" Yast.import "Security" Yast.import "Wizard" Yast.include include_target, "security/helps.rb" Yast.include include_target, "security/routines.rb" @tree_dialogs = [ "main", "overview", "password", "boot", "login", "users", "misc", :wizardTree ] @configurable_options = [ "PERMISSION_SECURITY", "RUNLEVEL3_MANDATORY_SERVICES", "RUNLEVEL5_MANDATORY_SERVICES", "RUNLEVEL3_EXTRA_SERVICES", "RUNLEVEL5_EXTRA_SERVICES", "kernel.sysrq" ] @UNKNOWN_STATUS = _("Unknown") @label_mapping = { "kernel.sysrq" => _("Use magic SysRq keys"), "PERMISSION_SECURITY" => _( "Use secure file permissions" ), "DISPLAYMANAGER_REMOTE_ACCESS" => _( "Remote access to the display manager" ), "CWD_IN_ROOT_PATH" => _( "Use current directory in root's path" ), "CWD_IN_USER_PATH" => _( "Use current directory in path of regular users" ), "SYSTOHC" => _( "Write back system time to the hardware clock" ), "SYSLOG_ON_NO_ERROR" => _( "Always generate syslog message for cron scripts" ), "DHCPD_RUN_CHROOTED" => _( "Run the DHCP daemon in a chroot" ), "DHCPD_RUN_AS" => _( "Run the DHCP daemon as dhcp user" ), "DISPLAYMANAGER_ROOT_LOGIN_REMOTE" => _( "Remote root login in the display manager" ), "DISPLAYMANAGER_XSERVER_TCP_PORT_6000_OPEN" => _( "Remote access to the X server" ), "SMTPD_LISTEN_REMOTE" => _( "Remote access to the email delivery subsystem" ), "DISABLE_RESTART_ON_UPDATE" => _( "Restart services on update" ), "DISABLE_STOP_ON_REMOVAL" => _( "Stop services on removal" ), "net.ipv4.tcp_syncookies" => _( "Enable TCP syncookies" ), "net.ipv4.ip_forward" => _("IPv4 forwarding"), "net.ipv6.conf.all.forwarding" => _("IPv6 forwarding"), "RUNLEVEL3_MANDATORY_SERVICES" => _( "Enable basic system services in runlevel 3\n (multiuser with network)" ), "RUNLEVEL5_MANDATORY_SERVICES" => _( "Enable basic system services in runlevel 5\n (multiuser with network and graphical login)" ), "RUNLEVEL3_EXTRA_SERVICES" => _( "Enable extra services in runlevel 3" ), "RUNLEVEL5_EXTRA_SERVICES" => _( "Enable extra services in runlevel 5" ) } # mapping for "Enable" and "Disable" links # current value -> new value @link_value_mapping = { "yes" => "no", "no" => "yes" } # mapping for "Configure" links # config name -> dialog name @link_config_mapping = { "PERMISSION_SECURITY" => "misc", "kernel.sysrq" => "misc" } # mapping for "Configure" links # config name -> yast client @link_client_mapping = { "RUNLEVEL3_MANDATORY_SERVICES" => "runlevel", "RUNLEVEL5_MANDATORY_SERVICES" => "runlevel", "RUNLEVEL3_EXTRA_SERVICES" => "runlevel", "RUNLEVEL5_EXTRA_SERVICES" => "runlevel" } @link_update_mapping = { "RUNLEVEL3_MANDATORY_SERVICES" => lambda { Security.ReadServiceSettings }, "RUNLEVEL5_MANDATORY_SERVICES" => lambda { Security.ReadServiceSettings }, "RUNLEVEL3_EXTRA_SERVICES" => lambda { Security.ReadServiceSettings }, "RUNLEVEL5_EXTRA_SERVICES" => lambda { Security.ReadServiceSettings } } end |
- (Object) LoginDialog
Login dialog
970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 |
# File '../../src/include/security/dialogs.rb', line 970 def LoginDialog # Login dialog caption caption = _("Login Settings") help = Ops.get_string(@HELPS, "login", "") # Login dialog contents contents = VBox( # Frame label XFrame( 3.0, 1.0, _("Login"), VBox( #VSeparator(), ("FAIL_DELAY"), #VSeparator() #VSeparator(), VSpacing(0.5), VSeparator(), ("DISPLAYMANAGER_REMOTE_ACCESS") ) ) #,`VSpacing(1.7) ) contents = HVCenter( HVSquash( HBox( HSpacing(5), VBox(VSpacing(2), ReplacePoint(Id(:rp_main), contents), VSpacing(2)), HSpacing(5) ) ) ) Wizard.SetContentsButtons( caption, contents, help, Label.BackButton, Label.OKButton ) Wizard.HideBackButton Wizard.SetAbortButton(:abort, Label.CancelButton) # select the dialog in the tree navigation Wizard.SelectTreeItem("login") ret = nil while true ret = UI.UserInput # abort? if ret == :abort || ret == :cancel if ReallyAbort() break else next end elsif ret == :back break elsif ret == :next || Builtins.contains(@tree_dialogs, ret) # the current item has been selected, do not change to the same dialog if ret == "login" # preselect the item if it has been unselected Wizard.SelectTreeItem("login") if Wizard.QueryTreeItem != "login" next end # check_* break else Builtins.y2error("Unexpected return code: %1", ret) next end end if ret == :next || Builtins.contains(@tree_dialogs, ret) ("FAIL_DELAY") ("DISPLAYMANAGER_REMOTE_ACCESS") end deep_copy(ret) end |
- (Object) MiscDialog
Misc dialog
733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 |
# File '../../src/include/security/dialogs.rb', line 733 def MiscDialog # Misc dialog caption caption = _("Miscellaneous Settings") help = Ops.get_string(@HELPS, "misc", "") # Misc dialog contents contents = VBox( VSeparator(), ("PERMISSION_SECURITY"), VSpacing(1.0), ("RUN_UPDATEDB_AS"), VSpacing(1.0), ("CWD_IN_ROOT_PATH"), VSeparator(), ("CWD_IN_USER_PATH"), VSpacing(1.0), ("kernel.sysrq"), VSpacing(1.8) ) contents = HVCenter( HVSquash( HBox( HSpacing(5), VBox(VSpacing(2), ReplacePoint(Id(:rp_main), contents), VSpacing(2)), HSpacing(5) ) ) ) Wizard.SetContentsButtons( caption, contents, help, Label.BackButton, Label.OKButton ) Wizard.HideBackButton Wizard.SetAbortButton(:abort, Label.CancelButton) # select the dialog in the tree navigation Wizard.SelectTreeItem("misc") ret = nil while true ret = UI.UserInput # abort? if ret == :abort || ret == :cancel if ReallyAbort() break else next end elsif ret == :back break elsif ret == :next || Builtins.contains(@tree_dialogs, ret) # the current item has been selected, do not change to the same dialog if ret == "misc" # preselect the item if it has been unselected Wizard.SelectTreeItem("misc") if Wizard.QueryTreeItem != "misc" next end # check_* break else Builtins.y2error("Unexpected return code: %1", ret) next end end if ret == :next || Builtins.contains(@tree_dialogs, ret) ("PERMISSION_SECURITY") ("CWD_IN_ROOT_PATH") ("CWD_IN_USER_PATH") ("RUN_UPDATEDB_AS") ("kernel.sysrq") end deep_copy(ret) end |
- (Object) OverviewDialog
470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 |
# File '../../src/include/security/dialogs.rb', line 470 def OverviewDialog # Overview dialog caption caption = _("Security Overview") help = Ops.get_string(@HELPS, "overview", "") no_richtext = !Ops.get_boolean( UI.GetDisplayInfo, "RichTextSupportsTable", true ) # table header tabheader = Header( _("Security Setting"), _("Status"), Center(_("Security Status")) ) contents = no_richtext ? Table(Id(:table), Opt(:immediate), tabheader, OverviewText(:table)) : RichText(Id(:rtext), OverviewText(:richtext)) if no_richtext # add a button box below the table contents = VBox( contents, VSpacing(1), HBox( # push button label PushButton(Id(:change), _("Change &Status")), HSpacing(2), # push button label PushButton(Id(:descr), _("&Description")) ), VSpacing(1) ) end Wizard.SetContentsButtons( caption, contents, help, Label.BackButton, Label.OKButton ) Wizard.HideBackButton Wizard.SetAbortButton(:abort, Label.CancelButton) # select the dialog in the tree navigation Wizard.SelectTreeItem("overview") ret = nil while true ret = UI.UserInput # abort? if ret == :abort || ret == :cancel if ReallyAbort() break else next end elsif ret == :back || ret == :next || Builtins.contains(@tree_dialogs, ret) # the current item has been selected, do not change to the same dialog if ret == "overview" # preselect the item if it has been unselected if Wizard.QueryTreeItem != "overview" Wizard.SelectTreeItem("overview") end next end break # user clicked a link in the richtext elsif Ops.is_string?(ret) && Builtins.haskey(Security.Settings, ret) || ret == :change if ret == :change # query the table in textmode ret = Convert.to_string(UI.QueryWidget(Id(:table), :CurrentItem)) end Builtins.y2milestone("Clicked %1 link", ret) current_value = Ops.get(Security.Settings, Convert.to_string(ret), "") new_value = Ops.get_string( @link_value_mapping, current_value, current_value ) # set the new value and refresh the overview if Builtins.haskey(@link_value_mapping, current_value) && new_value != current_value Builtins.y2milestone("New value for %1: %2", ret, new_value) Ops.set(Security.Settings, Convert.to_string(ret), new_value) # the config has been changed Security.SetModified if no_richtext UI.ChangeWidget(Id(:table), :Items, OverviewText(:table)) UI.ChangeWidget(Id(:table), :CurrentItem, ret) UI.SetFocus(Id(:table)) else UI.ChangeWidget(Id(:rtext), :Value, OverviewText(:richtext)) end elsif Builtins.haskey(@link_config_mapping, ret) new_dialog = Ops.get_string(@link_config_mapping, ret, "") Builtins.y2milestone("Switching to dialog %1", new_dialog) return new_dialog elsif Builtins.haskey(@link_client_mapping, ret) client = Ops.get_string(@link_client_mapping, ret, "") if client != "" Builtins.y2milestone("Calling Yast client %1", client) client_ret = WFM.CallFunction(client, []) Builtins.y2milestone("Client returned %1", client_ret) if client_ret == :next || client_ret == :ok || client_ret == :finish # update the current value if Builtins.haskey(@link_update_mapping, ret) Builtins.eval(Ops.get(@link_update_mapping, ret)) end # update the overview if no_richtext UI.ChangeWidget(Id(:table), :Items, OverviewText(:table)) UI.ChangeWidget(Id(:table), :CurrentItem, ret) UI.SetFocus(Id(:table)) else UI.ChangeWidget(Id(:rtext), :Value, OverviewText(:richtext)) end end end else Builtins.y2error("Unknown action for link %1", ret) end elsif Ops.is_string?(ret) && Builtins.regexpmatch(Convert.to_string(ret), "^help_") || ret == :descr help_id = no_richtext ? Convert.to_string(UI.QueryWidget(Id(:table), :CurrentItem)) : Builtins.regexpsub(Convert.to_string(ret), "^help_(.*)", "\\1") Builtins.y2milestone("Clicked help link: %1", help_id) DisplayHelpPopup(help_id) # switch the focus back to the table in text/GTK UI UI.SetFocus(Id(:table)) if no_richtext elsif ret == :table # disable "Change Status" button if the action is unknown current_item = Convert.to_string( UI.QueryWidget(Id(:table), :CurrentItem) ) status = SecurityStatus( current_item, # plaintext true ) UI.ChangeWidget(Id(:change), :Enabled, status != @UNKNOWN_STATUS) else Builtins.y2error("Unexpected return code: %1", ret) next end end deep_copy(ret) end |
- (Object) OverviewText(type)
179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 |
# File '../../src/include/security/dialogs.rb', line 179 def OverviewText(type) ret = "" ret_table = [] if type == :richtext # open a table ret = Builtins.sformat( "<TABLE><TR> <TD><BIG><B>%1</B></BIG></TD>\n" + "<TD ALIGN=center><BIG><B> %2 </B></BIG></TD>\n" + "<TD ALIGN=center><BIG><B> %3 </B></BIG></TD>\n" + "<TD></TD>\n" + "</TR> <TR></TR>", # table header _("Security Setting"), _("Status"), _("Security Status") ) end security_mapping = [ { "id" => "kernel.sysrq", "is_secure" => Ops.get(Security.Settings, "kernel.sysrq", "0") == "0" }, { "id" => "PERMISSION_SECURITY", "is_secure" => Ops.get(Security.Settings, "PERMISSION_SECURITY", "") == "secure" || Ops.get(Security.Settings, "PERMISSION_SECURITY", "") == "paranoid" }, { "id" => "DISPLAYMANAGER_REMOTE_ACCESS", "is_secure" => Ops.get( Security.Settings, "DISPLAYMANAGER_REMOTE_ACCESS", "" ) == "no" }, { "id" => "CWD_IN_ROOT_PATH", "is_secure" => Ops.get(Security.Settings, "CWD_IN_ROOT_PATH", "") == "no" }, { "id" => "CWD_IN_USER_PATH", "is_secure" => Ops.get(Security.Settings, "CWD_IN_USER_PATH", "") == "no" }, { "id" => "SYSTOHC", "is_secure" => Ops.get(Security.Settings, "SYSTOHC", "") == "yes" }, { "id" => "SYSLOG_ON_NO_ERROR", "is_secure" => Ops.get(Security.Settings, "SYSLOG_ON_NO_ERROR", "") == "yes" }, { "id" => "DHCPD_RUN_CHROOTED", "is_secure" => Ops.get(Security.Settings, "DHCPD_RUN_CHROOTED", "") == "yes" }, { "id" => "DHCPD_RUN_AS", "is_secure" => Ops.get(Security.Settings, "DHCPD_RUN_AS", "") == "dhcp" }, { "id" => "DISPLAYMANAGER_ROOT_LOGIN_REMOTE", "is_secure" => Ops.get( Security.Settings, "DISPLAYMANAGER_ROOT_LOGIN_REMOTE", "" ) == "no" }, { "id" => "DISPLAYMANAGER_XSERVER_TCP_PORT_6000_OPEN", "is_secure" => Ops.get( Security.Settings, "DISPLAYMANAGER_XSERVER_TCP_PORT_6000_OPEN", "" ) == "no" }, { "id" => "SMTPD_LISTEN_REMOTE", "is_secure" => Ops.get(Security.Settings, "SMTPD_LISTEN_REMOTE", "") == "no" }, { "id" => "DISABLE_RESTART_ON_UPDATE", "is_secure" => Ops.get( Security.Settings, "DISABLE_RESTART_ON_UPDATE", "" ) == "no" }, { "id" => "DISABLE_STOP_ON_REMOVAL", "is_secure" => Ops.get( Security.Settings, "DISABLE_STOP_ON_REMOVAL", "" ) == "no" }, { "id" => "net.ipv4.tcp_syncookies", "is_secure" => Ops.get( Security.Settings, "net.ipv4.tcp_syncookies", "" ) == "1" }, { "id" => "net.ipv4.ip_forward", "is_secure" => Ops.get(Security.Settings, "net.ipv4.ip_forward", "") == "0" }, { "id" => "net.ipv6.conf.all.forwarding", "is_secure" => Ops.get( Security.Settings, "net.ipv6.conf.all.forwarding", "" ) == "0" }, { "id" => "RUNLEVEL3_MANDATORY_SERVICES", "is_secure" => Ops.get( Security.Settings, "RUNLEVEL3_MANDATORY_SERVICES", "" ) == "secure" }, { "id" => "RUNLEVEL5_MANDATORY_SERVICES", "is_secure" => Ops.get( Security.Settings, "RUNLEVEL5_MANDATORY_SERVICES", "" ) == "secure" }, { "id" => "RUNLEVEL3_EXTRA_SERVICES", "is_secure" => Ops.get( Security.Settings, "RUNLEVEL3_EXTRA_SERVICES", "" ) == "secure" }, { "id" => "RUNLEVEL5_EXTRA_SERVICES", "is_secure" => Ops.get( Security.Settings, "RUNLEVEL5_EXTRA_SERVICES", "" ) == "secure" } ] Builtins.foreach(security_mapping) do |setting| current_value = Ops.get( Security.Settings, Ops.get_string(setting, "name", ""), "" ) id = Ops.get_string(setting, "id", "") if type == :table ret_table = Builtins.add( ret_table, Item( Id(id), Ops.get(@label_mapping, id, ""), SecurityStatus(id, true), Ops.get_boolean(setting, "is_secure", false) ? "\u2714" : "\u2718" ) ) elsif type == :richtext # add one line for each security setting ret = Ops.add( ret, Builtins.sformat( "<TR><TD>%1 </TD><TD ALIGN=center>%2</TD><TD ALIGN=center> %3</TD><TD>%4</TD></TR>", Ops.get(@label_mapping, id, ""), SecurityStatus(id, false), Ops.get_boolean(setting, "is_secure", false) ? "<SUP><FONT COLOR=green SIZE=20>\u2714</FONT></SUP>" : "<FONT COLOR=red SIZE=20><SUP>\u2718</SUP></FONT>", Builtins.haskey(@help_mapping, id) ? Builtins.sformat( "<A HREF=\"help_%1\">%2</A> <BR>", id, _("Help") ) : "" ) ) end end if type == :table Builtins.y2debug("Overview table: %1", ret_table) return deep_copy(ret_table) elsif type == :richtext # close the table ret = Ops.add(ret, "</TABLE>") Builtins.y2debug("Overview text: %1", ret) return ret end Builtins.y2error("Unknown type: %1", type) nil end |
- (Object) PassDialog
Password dialog
819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 |
# File '../../src/include/security/dialogs.rb', line 819 def PassDialog # Password dialog caption caption = _("Password Settings") help = Ops.get_string(@HELPS, "password", "") # Password dialog contents contents = VBox( # Frame label XFrame( 0.3, 0.15, _("Checks"), VBox( ("PASSWD_USE_CRACKLIB"), VSeparator(), ("PASS_MIN_LEN"), VSeparator(), ("PASSWD_REMEMBER_HISTORY"), VSeparator() ) ), VSpacing(0.4), ("PASSWD_ENCRYPTION"), VSpacing(0.4), # Frame label Frame( _("Password Age"), HBox( HSpacing(0.4), ("PASS_MIN_DAYS"), HSpacing(0.4), ("PASS_MAX_DAYS"), HSpacing(0.4) ) ), VSpacing(0.15), ("PASS_WARN_AGE"), VSpacing(0.0) ) contents = HVCenter( HVSquash( HBox( HSpacing(5), VBox(VSpacing(2), ReplacePoint(Id(:rp_main), contents), VSpacing(2)), HSpacing(5) ) ) ) Wizard.SetContentsButtons( caption, contents, help, Label.BackButton, Label.OKButton ) Wizard.HideBackButton Wizard.SetAbortButton(:abort, Label.CancelButton) # select the dialog in the tree navigation Wizard.SelectTreeItem("password") UI.ChangeWidget( Id("PASS_MIN_LEN"), :Enabled, Ops.get(Security.Settings, "PASSWD_USE_CRACKLIB", "") == "yes" ) ret = nil while true ret = UI.UserInput # abort? if ret == :abort || ret == :cancel if ReallyAbort() break else next end elsif ret == :back break elsif ret == "PASSWD_USE_CRACKLIB" # minlen is an option for pam_cracklib UI.ChangeWidget( Id("PASS_MIN_LEN"), :Enabled, UI.QueryWidget(Id(ret), :Value) == true ) elsif ret == :next || Builtins.contains(@tree_dialogs, ret) # the current item has been selected, do not change to the same dialog if ret == "password" # preselect the item if it has been unselected if Wizard.QueryTreeItem != "password" Wizard.SelectTreeItem("password") end next end # check_* if checkMinMax("PASS_MIN_DAYS", "PASS_MAX_DAYS") != true # Popup text Popup.Error( _( "The minimum number of days cannot be larger\nthan the maximum." ) ) next end enc = Convert.to_string( UI.QueryWidget(Id("PASSWD_ENCRYPTION"), :Value) ) min = Convert.to_integer(UI.QueryWidget(Id("PASS_MIN_LEN"), :Value)) if Ops.greater_than( min, Ops.get_integer(Security.PasswordMaxLengths, enc, 8) ) # Popup text, %1 is number Popup.Error( Builtins.sformat( _( "The minimum password length cannot be larger than the maximum.\nThe maximum password length for the selected encryption method is %1." ), Ops.get_integer(Security.PasswordMaxLengths, enc, 8) ) ) next end break elsif ret != "PASSWD_ENCRYPTION" Builtins.y2error("Unexpected return code: %1", ret) next end end if ret == :next || Builtins.contains(@tree_dialogs, ret) ("PASS_MIN_DAYS") ("PASS_MAX_DAYS") ("PASS_MIN_LEN") ("PASSWD_USE_CRACKLIB") ("PASS_WARN_AGE") ("PASSWD_ENCRYPTION") ("PASSWD_REMEMBER_HISTORY") end deep_copy(ret) end |
- (Object) SecurityStatus(option, plaintext)
153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 |
# File '../../src/include/security/dialogs.rb', line 153 def SecurityStatus(option, plaintext) ret = "" value = Ops.get(Security.Settings, option, "") Builtins.y2milestone("Option: %1, value: %2", option, value) # handle the special cases at first if Builtins.contains(@configurable_options, option) ret = _("Configure") elsif value == "yes" ret = _("Enabled") elsif value == "no" ret = _("Disabled") else return @UNKNOWN_STATUS end return ret if plaintext ret = Builtins.sformat("<A HREF=\"%1\">%2</A>", option, ret) ret end |