Class: Yast::SuSEFirewallProposalClass
- Inherits:
-
Module
- Object
- Module
- Yast::SuSEFirewallProposalClass
- Defined in:
- ../../src/modules/SuSEFirewallProposal.rb
Instance Method Summary (collapse)
-
- (Object) AddWarning(warning)
Local function adds another warning string into warnings for user.
-
- (Object) ClearWarnings
Local function clears all warnings for user from memory.
-
- (Object) EnableFallbackPorts(fallback_ports, zones)
Enables ports in zones.
-
- (Boolean) GetChangedByUser
Local function returns if proposal was changed by user.
-
- (Array<String>) GetKnownInterfaces
Local function returns list [string] of known interfaces.
-
- (Boolean) GetProposalInitialized
Local function returns if proposal was initialized already.
-
- (Array<String>) GetWarnings
Function returns list of warnings for user.
-
- (Boolean) IsDialUpInterface(interface)
Function returns if interface is a dial-up type.
-
- (Object) IsServiceOrPortsOpen(service, fallback_ports)
Checks whether the given service or (TCP) ports are open at least in one FW zone.
-
- (Boolean) IsXenInstalled
Local function returns whether the Xen kernel is installed.
- - (Object) main
-
- (Object) OpenServiceInInterfaces(service, fallback_ports, interfaces)
Function opens service for network interfaces given as the third parameter.
-
- (Object) OpenServiceOnNonDialUpInterfaces(service, fallback_ports)
Function opens up the service on all non-dial-up network interfaces.
-
- (Hash{String => String}) ProposalSummary
Function returns the proposal summary.
-
- (void) Propose
Function proposes the SuSEfirewall2 configuration.
-
- (Object) ProposeFunctions
Local function for proposing firewall configuration.
-
- (void) Reset
Function fills up default configuration into internal values.
-
- (Boolean) ServiceEnabled(service, zones)
Returns whether service is enabled in zones.
-
- (Object) SetChangedByUser(changed)
Function sets that proposal was changed by user.
-
- (Object) SetInterfacesToZone(interfaces, zone)
Local function adds list of interfaces into zone.
-
- (Object) SetKnownInterfaces(interfaces)
Local function sets currently known interfaces.
-
- (Object) SetProposalInitialized(initialized)
Function sets that proposal was initialized.
-
- (Object) UpdateProposal
Local function for updating user-changed proposal.
Instance Method Details
- (Object) AddWarning(warning)
Local function adds another warning string into warnings for user
78 79 80 81 82 |
# File '../../src/modules/SuSEFirewallProposal.rb', line 78 def AddWarning(warning) @warnings_now = Builtins.add(@warnings_now, warning) nil end |
- (Object) ClearWarnings
Local function clears all warnings for user from memory
85 86 87 88 89 |
# File '../../src/modules/SuSEFirewallProposal.rb', line 85 def ClearWarnings @warnings_now = [] nil end |
- (Object) EnableFallbackPorts(fallback_ports, zones)
Enables ports in zones.
234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 |
# File '../../src/modules/SuSEFirewallProposal.rb', line 234 def EnableFallbackPorts(fallback_ports, zones) fallback_ports = deep_copy(fallback_ports) zones = deep_copy(zones) Builtins.y2warning( "Enabling fallback ports: %1 in zones: %2", fallback_ports, zones ) Builtins.foreach(zones) do |one_zone| Builtins.foreach(fallback_ports) do |one_port| SuSEFirewall.AddService(one_port, "TCP", one_zone) end end nil end |
- (Boolean) GetChangedByUser
Local function returns if proposal was changed by user
492 493 494 |
# File '../../src/modules/SuSEFirewallProposal.rb', line 492 def GetChangedByUser @proposal_changed_by_user end |
- (Array<String>) GetKnownInterfaces
Local function returns list [string] of known interfaces. They must have been set using SetKnownInterfaces(list [string] interfaces) function.
113 114 115 |
# File '../../src/modules/SuSEFirewallProposal.rb', line 113 def GetKnownInterfaces deep_copy(@known_interfaces) end |
- (Boolean) GetProposalInitialized
Local function returns if proposal was initialized already
508 509 510 |
# File '../../src/modules/SuSEFirewallProposal.rb', line 508 def GetProposalInitialized @proposal_initialized end |
- (Array<String>) GetWarnings
Function returns list of warnings for user
94 95 96 |
# File '../../src/modules/SuSEFirewallProposal.rb', line 94 def GetWarnings deep_copy(@warnings_now) end |
- (Boolean) IsDialUpInterface(interface)
Function returns if interface is a dial-up type.
120 121 122 123 124 125 126 127 128 129 130 131 |
# File '../../src/modules/SuSEFirewallProposal.rb', line 120 def IsDialUpInterface(interface) all_interfaces = SuSEFirewall.GetAllKnownInterfaces interface_type = nil Builtins.foreach(all_interfaces) do |one| next if Ops.get(one, "id") != interface # this is THE interface interface_type = Ops.get(one, "type") end interface_type == "dialup" end |
- (Object) IsServiceOrPortsOpen(service, fallback_ports)
Checks whether the given service or (TCP) ports are open at least in one FW zone.
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 |
# File '../../src/modules/SuSEFirewallProposal.rb', line 288 def IsServiceOrPortsOpen(service, fallback_ports) fallback_ports = deep_copy(fallback_ports) ret = false Builtins.foreach(SuSEFirewall.GetKnownFirewallZones) do |zone| # either service is supported if SuSEFirewall.IsServiceSupportedInZone(service, zone) ret = true # or check for ports else all_ports = true # all ports have to be open Builtins.foreach(fallback_ports) do |port| if !SuSEFirewall.HaveService(port, "TCP", zone) all_ports = false raise Break end end ret = true if all_ports end raise Break if ret == true end ret end |
- (Boolean) IsXenInstalled
Local function returns whether the Xen kernel is installed
355 356 357 358 359 360 361 |
# File '../../src/modules/SuSEFirewallProposal.rb', line 355 def IsXenInstalled # bug #154133 return true if Package.Installed("kernel-xen") return true if Package.Installed("kernel-xenpae") false end |
- (Object) main
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 |
# File '../../src/modules/SuSEFirewallProposal.rb', line 36 def main textdomain "base" Yast.import "SuSEFirewall" Yast.import "ProductFeatures" Yast.import "Linuxrc" Yast.import "Package" Yast.import "SuSEFirewallServices" # <!-- SuSEFirewall LOCAL VARIABLES //--> # proposal was changed by user @proposal_changed_by_user = false # proposal was initialized yet @proposal_initialized = false # known interfaces @known_interfaces = [] # warnings for this "turn" @warnings_now = [] @vnc_fallback_ports = ["5801", "5901"] # bnc #427708, yet another name of service @vnc_service = "service:xorg-x11-server" @ssh_service = "service:sshd" @iscsi_target_service = "service:iscsitarget" @iscsi_target_fallback_ports = ["iscsi-target"] end |
- (Object) OpenServiceInInterfaces(service, fallback_ports, interfaces)
Function opens service for network interfaces given as the third parameter. Fallback ports are used if the given service is uknown.
260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 |
# File '../../src/modules/SuSEFirewallProposal.rb', line 260 def OpenServiceInInterfaces(service, fallback_ports, interfaces) fallback_ports = deep_copy(fallback_ports) interfaces = deep_copy(interfaces) zones = SuSEFirewall.GetZonesOfInterfaces(interfaces) if SuSEFirewallServices.IsKnownService(service) Builtins.y2milestone( "Opening service %1 on interfaces %2 (zones %3)", service, interfaces, zones ) SuSEFirewall.SetServicesForZones([service], zones, true) end if SuSEFirewallServices.IsKnownService(service) != true || ServiceEnabled(service, interfaces) != true EnableFallbackPorts(fallback_ports, interfaces) end nil end |
- (Object) OpenServiceOnNonDialUpInterfaces(service, fallback_ports)
Function opens up the service on all non-dial-up network interfaces. If there are no network interfaces known and the 'any' feature is supported, function opens the service for the zone supporting that feature. If there are only dial-up interfaces, function opens the service for them.
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 |
# File '../../src/modules/SuSEFirewallProposal.rb', line 323 def OpenServiceOnNonDialUpInterfaces(service, fallback_ports) fallback_ports = deep_copy(fallback_ports) non_dial_up_interfaces = SuSEFirewall.GetAllNonDialUpInterfaces dial_up_interfaces = SuSEFirewall.GetAllDialUpInterfaces # Opening the service for non-dial-up interfaces if Ops.greater_than(Builtins.size(non_dial_up_interfaces), 0) OpenServiceInInterfaces(service, fallback_ports, non_dial_up_interfaces) # Only dial-up network interfaces, there mustn't be any non-dial-up one elsif Ops.greater_than(Builtins.size(dial_up_interfaces), 0) OpenServiceInInterfaces(service, fallback_ports, dial_up_interfaces) # No network interfaces are known elsif Builtins.size(@known_interfaces) == 0 if SuSEFirewall.IsAnyNetworkInterfaceSupported == true Builtins.y2warning( "WARNING: Opening %1 for the External zone without any known interface!", Builtins.toupper(service) ) OpenServiceInInterfaces( service, fallback_ports, [SuSEFirewall.special_all_interface_string] ) end end nil end |
- (Hash{String => String}) ProposalSummary
Function returns the proposal summary
Structure:
map
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 641 642 643 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 730 731 732 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 |
# File '../../src/modules/SuSEFirewallProposal.rb', line 557 def ProposalSummary # output: $[ "output" : "HTML Proposal", "warning" : "HTML Warning" ]; output = "" warning = "" # SuSEfirewall2 package needn't be installed if !SuSEFirewall.SuSEFirewallIsInstalled # TRANSLATORS: Proposal informative text output = "<ul>" + _( "SuSEfirewall2 package is not installed, firewall will be disabled." ) + "</ul>" return { "output" => output, "warning" => warning } end # SuSEfirewall2 is installed... firewall_is_enabled = SuSEFirewall.GetEnableService == true output = Ops.add(output, "<ul>\n") output = Ops.add( Ops.add( Ops.add(output, "<li>"), if firewall_is_enabled # TRANSLATORS: Proposal informative text "Firewall is enabled (disable)" with link around # IMPORTANT: Please, do not change the HTML link <a href="...">...</a>, only visible text _( "Firewall is enabled (<a href=\"firewall--disable_firewall_in_proposal\">disable</a>)" ) else # TRANSLATORS: Proposal informative text "Firewall is disabled (enable)" with link around # IMPORTANT: Please, do not change the HTML link <a href="...">...</a>, only visible text _( "Firewall is disabled (<a href=\"firewall--enable_firewall_in_proposal\">enable</a>)" ) end ), "</li>\n" ) if firewall_is_enabled # Any enabled SSH means SSH-is-enabled is_ssh_enabled = false # Any known interfaces if Ops.greater_than(Builtins.size(@known_interfaces), 0) Builtins.y2milestone("Interfaces: %1", @known_interfaces) # all known interfaces for testing used_zones = SuSEFirewall.GetZonesOfInterfacesWithAnyFeatureSupported( @known_interfaces ) Builtins.y2milestone("Zones used by firewall: %1", used_zones) Builtins.foreach(used_zones) do |zone| if SuSEFirewall.IsServiceSupportedInZone(@ssh_service, zone) || SuSEFirewall.HaveService("ssh", "TCP", zone) is_ssh_enabled = true end end output = Ops.add( Ops.add( Ops.add(output, "<li>"), if is_ssh_enabled # TRANSLATORS: Network proposal informative text with link around # IMPORTANT: Please, do not change the HTML link <a href="...">...</a>, only visible text _( "SSH port is open (<a href=\"firewall--disable_ssh_in_proposal\">close</a>)" ) else # TRANSLATORS: Network proposal informative text with link around # IMPORTANT: Please, do not change the HTML link <a href="...">...</a>, only visible text _( "SSH port is blocked (<a href=\"firewall--enable_ssh_in_proposal\">open</a>)" ) end ), "</li>\n" ) # No known interfaces, but 'any' is supported # and ssh is enabled there elsif SuSEFirewall.IsAnyNetworkInterfaceSupported && SuSEFirewall.IsServiceSupportedInZone( @ssh_service, SuSEFirewall.special_all_interface_zone ) is_ssh_enabled = true # TRANSLATORS: Network proposal informative text with link around # IMPORTANT: Please, do not change the HTML link <a href="...">...</a>, only visible text output = Ops.add( Ops.add( Ops.add(output, "<li>"), _( "SSH port is open (<a href=\"firewall--disable_ssh_in_proposal\">close</a>), but\nthere are no network interfaces configured" ) ), "</li>" ) end Builtins.y2milestone( "SSH is " + (is_ssh_enabled ? "" : "not ") + "enabled" ) if Linuxrc.usessh if !is_ssh_enabled # TRANSLATORS: This is a warning message. Installation over SSH without SSH allowed on firewall AddWarning( _( "You are installing a system over SSH, but you have not opened the SSH port on the firewall." ) ) end end # when the firewall is enabled and we are installing the system over VNC if Linuxrc.vnc # Any enabled VNC means VNC-is-enabled is_vnc_enabled = false if Ops.greater_than(Builtins.size(@known_interfaces), 0) Builtins.foreach( SuSEFirewall.GetZonesOfInterfacesWithAnyFeatureSupported( @known_interfaces ) ) do |zone| if SuSEFirewall.IsServiceSupportedInZone(@vnc_service, zone) == true is_vnc_enabled = true # checking also fallback ports else set_vnc_enabled_to = true Builtins.foreach(@vnc_fallback_ports) do |one_port| if SuSEFirewall.HaveService(one_port, "TCP", zone) != true set_vnc_enabled_to = false raise Break end is_vnc_enabled = true if set_vnc_enabled_to == true end end end end Builtins.y2milestone( "VNC port is " + (is_vnc_enabled ? "open" : "blocked") + " in the firewall" ) output = Ops.add( Ops.add( Ops.add(output, "<li>"), if is_vnc_enabled # TRANSLATORS: Network proposal informative text "Remote Administration (VNC) is enabled" with link around # IMPORTANT: Please, do not change the HTML link <a href="...">...</a>, only visible text _( "Remote Administration (VNC) ports are open (<a href=\"firewall--disable_vnc_in_proposal\">close</a>)" ) else # TRANSLATORS: Network proposal informative text "Remote Administration (VNC) is disabled" with link around # IMPORTANT: Please, do not change the HTML link <a href="...">...</a>, only visible text _( "Remote Administration (VNC) ports are blocked (<a href=\"firewall--enable_vnc_in_proposal\">open</a>)" ) end ), "</li>\n" ) if !is_vnc_enabled # TRANSLATORS: This is a warning message. Installation over VNC without VNC allowed on firewall AddWarning( _( "You are installing a system using remote administration (VNC), but you have not opened the VNC ports on the firewall." ) ) end end if Linuxrc.useiscsi is_iscsi_enabled = IsServiceOrPortsOpen( @iscsi_target_service, @iscsi_target_fallback_ports ) output = Ops.add( Ops.add( Ops.add(output, "<li>"), if is_iscsi_enabled # TRANSLATORS: Network proposal informative text _("iSCSI Target ports are open") else # TRANSLATORS: Network proposal informative text _("iSCSI Target ports are blocked") end ), "</li>\n" ) if !is_iscsi_enabled # TRANSLATORS: This is a warning message. Installation to iSCSI without iSCSI allowed on firewall AddWarning( _( "You are installing a system using iSCSI Target, but you have not opened the needed ports on the firewall." ) ) end end warnings_strings = GetWarnings() if Ops.greater_than(Builtins.size(warnings_strings), 0) ClearWarnings() Builtins.foreach(warnings_strings) do |single_warning| warning = Ops.add( Ops.add(Ops.add(warning, "<li>"), single_warning), "</li>\n" ) end warning = Ops.add(Ops.add("<ul>\n", warning), "</ul>\n") end end output = Ops.add(output, "</ul>\n") { "output" => output, "warning" => warning } end |
- (void) Propose
This method returns an undefined value.
Function proposes the SuSEfirewall2 configuration
525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 |
# File '../../src/modules/SuSEFirewallProposal.rb', line 525 def Propose # No proposal when SuSEfirewall2 is not installed if !SuSEFirewall.SuSEFirewallIsInstalled SuSEFirewall.SetEnableService(false) SuSEFirewall.SetStartService(false) return nil end # Not changed by user - Propose from scratch if !GetChangedByUser() Builtins.y2milestone("Calling firewall configuration proposal") Reset() ProposeFunctions() # Changed - don't break user's configuration else Builtins.y2milestone("Calling firewall configuration update proposal") UpdateProposal() end nil end |
- (Object) ProposeFunctions
Local function for proposing firewall configuration.
364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 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 469 470 471 472 473 |
# File '../../src/modules/SuSEFirewallProposal.rb', line 364 def ProposeFunctions known_interfaces = SuSEFirewall.GetAllKnownInterfaces dial_up_interfaces = [] non_dup_interfaces = [] Builtins.foreach(known_interfaces) do |interface| if Ops.get(interface, "type") == "dial_up" dial_up_interfaces = Builtins.add( dial_up_interfaces, Ops.get(interface, "id", "") ) else non_dup_interfaces = Builtins.add( non_dup_interfaces, Ops.get(interface, "id", "") ) end end Builtins.y2milestone( "Proposal based on configuration: Dial-up interfaces: %1, Other: %2", dial_up_interfaces, non_dup_interfaces ) # has any network interface if Builtins.size(non_dup_interfaces) == 0 || Builtins.size(dial_up_interfaces) == 0 SuSEFirewall.SetEnableService( ProductFeatures.GetBooleanFeature("globals", "enable_firewall") ) SuSEFirewall.SetStartService( ProductFeatures.GetBooleanFeature("globals", "enable_firewall") ) end # has non-dial-up and also dial-up interfaces if Ops.greater_than(Builtins.size(non_dup_interfaces), 0) && Ops.greater_than(Builtins.size(dial_up_interfaces), 0) SetInterfacesToZone(non_dup_interfaces, "INT") SetInterfacesToZone(dial_up_interfaces, "EXT") if ProductFeatures.GetBooleanFeature("globals", "firewall_enable_ssh") SuSEFirewall.SetServicesForZones([@ssh_service], ["INT", "EXT"], true) end # has non-dial-up and doesn't have dial-up interfaces elsif Ops.greater_than(Builtins.size(non_dup_interfaces), 0) && Builtins.size(dial_up_interfaces) == 0 SetInterfacesToZone(non_dup_interfaces, "EXT") if ProductFeatures.GetBooleanFeature("globals", "firewall_enable_ssh") SuSEFirewall.SetServicesForZones([@ssh_service], ["EXT"], true) end # doesn't have non-dial-up and has dial-up interfaces elsif Builtins.size(non_dup_interfaces) == 0 && Ops.greater_than(Builtins.size(dial_up_interfaces), 0) SetInterfacesToZone(dial_up_interfaces, "EXT") if ProductFeatures.GetBooleanFeature("globals", "firewall_enable_ssh") SuSEFirewall.SetServicesForZones([@ssh_service], ["EXT"], true) end end # Dial-up interfaces are considered to be internal, # Non-dial-up are considered to be external. # If there are only Non-dial-up interfaces, they are all considered as external. # # VNC Installation proposes to open VNC Access up on the Non-dial-up interfaces only. # SSH Installation is the same case... if Linuxrc.vnc Builtins.y2milestone( "This is an installation over VNC, opening VNC on all non-dial-up interfaces..." ) # Try the service first, then ports # bnc #398855 OpenServiceOnNonDialUpInterfaces(@vnc_service, @vnc_fallback_ports) end if Linuxrc.usessh Builtins.y2milestone( "This is an installation over SSH, opening SSH on all non-dial-up interfaces..." ) # Try the service first, then ports # bnc #398855 OpenServiceOnNonDialUpInterfaces(@ssh_service, ["ssh"]) end # Firewall support for XEN domain0 if IsXenInstalled() Builtins.y2milestone( "Adding Xen support into the firewall configuration" ) SuSEFirewall.AddXenSupport end # BNC #766300 - Automatically propose opening iscsi-target port # when installing with withiscsi=1 if Linuxrc.useiscsi Builtins.y2milestone( "iSCSI has been used during installation, opening %1 service", @iscsi_target_service ) OpenServiceOnNonDialUpInterfaces( @iscsi_target_service, @iscsi_target_fallback_ports ) end SetKnownInterfaces(SuSEFirewall.GetListOfKnownInterfaces) nil end |
- (void) Reset
This method returns an undefined value.
Function fills up default configuration into internal values
515 516 517 518 519 520 |
# File '../../src/modules/SuSEFirewallProposal.rb', line 515 def Reset SuSEFirewall.ResetReadFlag SuSEFirewall.Read nil end |
- (Boolean) ServiceEnabled(service, zones)
Returns whether service is enabled in zones.
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 |
# File '../../src/modules/SuSEFirewallProposal.rb', line 200 def ServiceEnabled(service, zones) zones = deep_copy(zones) if service.nil? || service == "" Builtins.y2error("Ups, service: %1?", service) return false end if zones.nil? || zones == [] Builtins.y2error("Ups, zones: %1?", zones) return false end serenabled = true serstat = SuSEFirewall.GetServices([service]) Builtins.foreach(zones) do |one_zone| if Ops.get(serstat, [service, one_zone]) == false Builtins.y2milestone( "Service %1 is not enabled in %2", service, one_zone ) serenabled = false raise Break end end serenabled end |
- (Object) SetChangedByUser(changed)
Function sets that proposal was changed by user
482 483 484 485 486 487 |
# File '../../src/modules/SuSEFirewallProposal.rb', line 482 def SetChangedByUser(changed) Builtins.y2milestone("Proposal was changed by user") @proposal_changed_by_user = changed nil end |
- (Object) SetInterfacesToZone(interfaces, zone)
Local function adds list of interfaces into zone.
137 138 139 140 141 142 143 144 |
# File '../../src/modules/SuSEFirewallProposal.rb', line 137 def SetInterfacesToZone(interfaces, zone) interfaces = deep_copy(interfaces) Builtins.foreach(interfaces) do |interface| SuSEFirewall.AddInterfaceIntoZone(interface, zone) end nil end |
- (Object) SetKnownInterfaces(interfaces)
Local function sets currently known interfaces.
101 102 103 104 105 106 |
# File '../../src/modules/SuSEFirewallProposal.rb', line 101 def SetKnownInterfaces(interfaces) interfaces = deep_copy(interfaces) @known_interfaces = deep_copy(interfaces) nil end |
- (Object) SetProposalInitialized(initialized)
Function sets that proposal was initialized
499 500 501 502 503 |
# File '../../src/modules/SuSEFirewallProposal.rb', line 499 def SetProposalInitialized(initialized) @proposal_initialized = initialized nil end |
- (Object) UpdateProposal
Local function for updating user-changed proposal.
147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 |
# File '../../src/modules/SuSEFirewallProposal.rb', line 147 def UpdateProposal last_known_interfaces = GetKnownInterfaces() currently_known_interfaces = SuSEFirewall.GetListOfKnownInterfaces had_dialup_interfaces = false Builtins.foreach(last_known_interfaces) do |this_interface| if IsDialUpInterface(this_interface) had_dialup_interfaces = true raise Break end end Builtins.foreach(currently_known_interfaces) do |interface| # already known but not assigned next if Builtins.contains(last_known_interfaces, interface) # already configured in some zone next if !SuSEFirewall.GetZoneOfInterface(interface).nil? # any dial-up interfaces presented and the new one isn't dial-up if had_dialup_interfaces && !IsDialUpInterface(interface) AddWarning( Builtins.sformat( # TRANSLATORS: Warning in installation proposal, %1 is a device name (eth0, sl0, ...) _( "New network device '%1' found; added as an internal firewall interface" ), interface ) ) SetInterfacesToZone([interface], "INT") else AddWarning( Builtins.sformat( # TRANSLATORS: Warning in installation proposal, %1 is a device name (eth0, sl0, ...) _( "New network device '%1' found; added as an external firewall interface" ), interface ) ) SetInterfacesToZone([interface], "EXT") end end SetKnownInterfaces(currently_known_interfaces) nil end |