Hello community, here is the log from the commit of package yast2-firewall for openSUSE:Factory checked in at 2020-10-18 16:23:13 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/yast2-firewall (Old) and /work/SRC/openSUSE:Factory/.yast2-firewall.new.3486 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "yast2-firewall" Sun Oct 18 16:23:13 2020 rev:85 rq:841524 version:4.3.6 Changes: -------- --- /work/SRC/openSUSE:Factory/yast2-firewall/yast2-firewall.changes 2020-08-14 13:10:23.101234333 +0200 +++ /work/SRC/openSUSE:Factory/.yast2-firewall.new.3486/yast2-firewall.changes 2020-10-18 16:23:23.812543582 +0200 @@ -1,0 +2,15 @@ +Tue Oct 13 11:15:06 UTC 2020 - Knut Anderssen <kanders...@suse.com> + +- Modified the warning text introduced in previous change according + to suggestions (jsc#SLE-1567) +- 4.3.6 + +------------------------------------------------------------------- +Fri Oct 9 10:42:32 UTC 2020 - Knut Anderssen <kanders...@suse.com> + +- Warn the user when the SSH port is closed or the service is + disabled and the configured authentication is only based on SSH + key (jsc#SLE-15675) +- 4.3.5 + +------------------------------------------------------------------- Old: ---- yast2-firewall-4.3.4.tar.bz2 New: ---- yast2-firewall-4.3.6.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ yast2-firewall.spec ++++++ --- /var/tmp/diff_new_pack.RY6nVs/_old 2020-10-18 16:23:24.296543797 +0200 +++ /var/tmp/diff_new_pack.RY6nVs/_new 2020-10-18 16:23:24.300543799 +0200 @@ -1,7 +1,7 @@ # # spec file for package yast2-firewall # -# Copyright (c) 2020 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2020 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -12,17 +12,17 @@ # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. -# Please submit bugfixes or comments via http://bugs.opensuse.org/ +# Please submit bugfixes or comments via https://bugs.opensuse.org/ # Name: yast2-firewall -Version: 4.3.4 +Version: 4.3.6 Release: 0 Summary: YaST2 - Firewall Configuration License: GPL-2.0-only Group: System/YaST -Url: https://github.com/yast/yast-firewall +URL: https://github.com/yast/yast-firewall Source0: %{name}-%{version}.tar.bz2 ++++++ yast2-firewall-4.3.4.tar.bz2 -> yast2-firewall-4.3.6.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-firewall-4.3.4/.rubocop.yml new/yast2-firewall-4.3.6/.rubocop.yml --- old/yast2-firewall-4.3.4/.rubocop.yml 2020-08-13 09:59:42.000000000 +0200 +++ new/yast2-firewall-4.3.6/.rubocop.yml 2020-10-13 13:48:47.000000000 +0200 @@ -1,12 +1,16 @@ # use the shared YaST defaults inherit_from: - /usr/share/YaST2/data/devtools/data/rubocop_yast_style.yml + /usr/share/YaST2/data/devtools/data/rubocop-0.71.0_yast_style.yml Metrics/CyclomaticComplexity: Max: 10 -AllCops: +Metrics/BlockLength: + Max: 86 Exclude: - - "src/modules/*.rb" - - "src/clients/firewall_auto.rb" - - "src/include/*/*.rb" + - "test/**/*" + +# this needs more testing if we can have frozen string literals +Style/FrozenStringLiteralComment: + Enabled: false + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-firewall-4.3.4/package/yast2-firewall.changes new/yast2-firewall-4.3.6/package/yast2-firewall.changes --- old/yast2-firewall-4.3.4/package/yast2-firewall.changes 2020-08-13 09:59:42.000000000 +0200 +++ new/yast2-firewall-4.3.6/package/yast2-firewall.changes 2020-10-13 13:48:47.000000000 +0200 @@ -1,4 +1,19 @@ ------------------------------------------------------------------- +Tue Oct 13 11:15:06 UTC 2020 - Knut Anderssen <kanders...@suse.com> + +- Modified the warning text introduced in previous change according + to suggestions (jsc#SLE-1567) +- 4.3.6 + +------------------------------------------------------------------- +Fri Oct 9 10:42:32 UTC 2020 - Knut Anderssen <kanders...@suse.com> + +- Warn the user when the SSH port is closed or the service is + disabled and the configured authentication is only based on SSH + key (jsc#SLE-15675) +- 4.3.5 + +------------------------------------------------------------------- Thu Aug 13 07:52:47 UTC 2020 - Michal Filka <mfi...@suse.com> - AutoYaST: moved the configuration into first stage (bsc#1173624) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-firewall-4.3.4/package/yast2-firewall.spec new/yast2-firewall-4.3.6/package/yast2-firewall.spec --- old/yast2-firewall-4.3.4/package/yast2-firewall.spec 2020-08-13 09:59:42.000000000 +0200 +++ new/yast2-firewall-4.3.6/package/yast2-firewall.spec 2020-10-13 13:48:47.000000000 +0200 @@ -17,7 +17,7 @@ Name: yast2-firewall -Version: 4.3.4 +Version: 4.3.6 Release: 0 Summary: YaST2 - Firewall Configuration Group: System/YaST diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-firewall-4.3.4/src/clients/firewall.rb new/yast2-firewall-4.3.6/src/clients/firewall.rb --- old/yast2-firewall-4.3.4/src/clients/firewall.rb 2020-08-13 09:59:42.000000000 +0200 +++ new/yast2-firewall-4.3.6/src/clients/firewall.rb 2020-10-13 13:48:47.000000000 +0200 @@ -1,5 +1,3 @@ -# encoding: utf-8 - # ------------------------------------------------------------------------------ # Copyright (c) 2017 SUSE LLC # diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-firewall-4.3.4/src/clients/firewall_auto.rb new/yast2-firewall-4.3.6/src/clients/firewall_auto.rb --- old/yast2-firewall-4.3.4/src/clients/firewall_auto.rb 2020-08-13 09:59:42.000000000 +0200 +++ new/yast2-firewall-4.3.6/src/clients/firewall_auto.rb 2020-10-13 13:48:47.000000000 +0200 @@ -1,5 +1,3 @@ -# encoding: utf-8 - # ------------------------------------------------------------------------------ # Copyright (c) 2017 SUSE LLC # diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-firewall-4.3.4/src/clients/firewall_finish.rb new/yast2-firewall-4.3.6/src/clients/firewall_finish.rb --- old/yast2-firewall-4.3.4/src/clients/firewall_finish.rb 2020-08-13 09:59:42.000000000 +0200 +++ new/yast2-firewall-4.3.6/src/clients/firewall_finish.rb 2020-10-13 13:48:47.000000000 +0200 @@ -1,5 +1,3 @@ -# encoding: utf-8 - # ------------------------------------------------------------------------------ # Copyright (c) 2017 SUSE LLC # diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-firewall-4.3.4/src/clients/firewall_proposal.rb new/yast2-firewall-4.3.6/src/clients/firewall_proposal.rb --- old/yast2-firewall-4.3.4/src/clients/firewall_proposal.rb 2020-08-13 09:59:42.000000000 +0200 +++ new/yast2-firewall-4.3.6/src/clients/firewall_proposal.rb 2020-10-13 13:48:47.000000000 +0200 @@ -1,5 +1,3 @@ -# encoding: utf-8 - # ------------------------------------------------------------------------------ # Copyright (c) 2017 SUSE LLC # diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-firewall-4.3.4/src/lib/y2firewall/autoyast.rb new/yast2-firewall-4.3.6/src/lib/y2firewall/autoyast.rb --- old/yast2-firewall-4.3.4/src/lib/y2firewall/autoyast.rb 2020-08-13 09:59:42.000000000 +0200 +++ new/yast2-firewall-4.3.6/src/lib/y2firewall/autoyast.rb 2020-10-13 13:48:47.000000000 +0200 @@ -1,5 +1,3 @@ -# encoding: utf-8 - # ------------------------------------------------------------------------------ # Copyright (c) 2017 SUSE LLC # diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-firewall-4.3.4/src/lib/y2firewall/clients/auto.rb new/yast2-firewall-4.3.6/src/lib/y2firewall/clients/auto.rb --- old/yast2-firewall-4.3.4/src/lib/y2firewall/clients/auto.rb 2020-08-13 09:59:42.000000000 +0200 +++ new/yast2-firewall-4.3.6/src/lib/y2firewall/clients/auto.rb 2020-10-13 13:48:47.000000000 +0200 @@ -1,5 +1,3 @@ -# encoding: utf-8 - # ------------------------------------------------------------------------------ # Copyright (c) 2017 SUSE LLC # @@ -203,17 +201,17 @@ zones = export["zones"] || [] all_interfaces = zones.flat_map { |zone| zone["interfaces"] || [] } double_entries = all_interfaces.select { |i| all_interfaces.count(i) > 1 }.uniq - unless double_entries.empty? - AutoInstall.issues_list.add( - ::Installation::AutoinstIssues::InvalidValue, - Y2Firewall::AutoinstProfile::FirewallSection.new_from_hashes( - self.class.profile - ), - "interfaces", - double_entries.join(","), - _("This interface has been defined for more than one zone.") - ) - end + return if double_entries.empty? + + AutoInstall.issues_list.add( + ::Installation::AutoinstIssues::InvalidValue, + Y2Firewall::AutoinstProfile::FirewallSection.new_from_hashes( + self.class.profile + ), + "interfaces", + double_entries.join(","), + _("This interface has been defined for more than one zone.") + ) end # Depending on the profile it activates or deactivates the firewalld diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-firewall-4.3.4/src/lib/y2firewall/clients/firewall.rb new/yast2-firewall-4.3.6/src/lib/y2firewall/clients/firewall.rb --- old/yast2-firewall-4.3.4/src/lib/y2firewall/clients/firewall.rb 2020-08-13 09:59:42.000000000 +0200 +++ new/yast2-firewall-4.3.6/src/lib/y2firewall/clients/firewall.rb 2020-10-13 13:48:47.000000000 +0200 @@ -51,8 +51,9 @@ def run log_and_return do return :abort unless Yast::PackageSystem.CheckAndInstallPackages(["firewalld"]) + if !Yast::WFM.Args.empty? - $stderr.puts _(NOT_SUPPORTED) + warn _(NOT_SUPPORTED) false else Dialogs::Main.new.run diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-firewall-4.3.4/src/lib/y2firewall/clients/installation_finish.rb new/yast2-firewall-4.3.6/src/lib/y2firewall/clients/installation_finish.rb --- old/yast2-firewall-4.3.4/src/lib/y2firewall/clients/installation_finish.rb 2020-08-13 09:59:42.000000000 +0200 +++ new/yast2-firewall-4.3.6/src/lib/y2firewall/clients/installation_finish.rb 2020-10-13 13:48:47.000000000 +0200 @@ -1,5 +1,3 @@ -# encoding: utf-8 - # ------------------------------------------------------------------------------ # Copyright (c) 2017 SUSE LLC # @@ -101,13 +99,13 @@ # Convenience method to open the vnc ports in firewalld depending on the # proposal settings def configure_vnc - if @settings.open_vnc - if @firewalld.api.service_supported?("tigervnc") - @firewalld.api.add_service(@settings.default_zone, "tigervnc") - @firewalld.api.add_service(@settings.default_zone, "tigervnc-https") - else - log.error "tigervnc service definition is not available" - end + return unless @settings.open_vnc + + if @firewalld.api.service_supported?("tigervnc") + @firewalld.api.add_service(@settings.default_zone, "tigervnc") + @firewalld.api.add_service(@settings.default_zone, "tigervnc-https") + else + log.error "tigervnc service definition is not available" end end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-firewall-4.3.4/src/lib/y2firewall/clients/proposal.rb new/yast2-firewall-4.3.6/src/lib/y2firewall/clients/proposal.rb --- old/yast2-firewall-4.3.4/src/lib/y2firewall/clients/proposal.rb 2020-08-13 09:59:42.000000000 +0200 +++ new/yast2-firewall-4.3.6/src/lib/y2firewall/clients/proposal.rb 2020-10-13 13:48:47.000000000 +0200 @@ -76,7 +76,8 @@ { "preformatted_proposal" => preformatted_proposal, "warning_level" => :warning, - "links" => SERVICES_LINKS + "links" => SERVICES_LINKS, + "warning" => warning } end @@ -84,6 +85,15 @@ Yast::HTML.List(proposals) end + def warning + return nil unless @settings.access_problem? + + # TRANSLATORS: proposal warning text preventing the user to block + # the root login by error. + _("The 'root' user uses only SSH key-based authentication. <br>" \ + "With the current settings the user might not be allowed to login.") + end + def ask_user(param) chosen_link = param["chosen_id"] result = :next diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-firewall-4.3.4/src/lib/y2firewall/dialogs/change_zone.rb new/yast2-firewall-4.3.6/src/lib/y2firewall/dialogs/change_zone.rb --- old/yast2-firewall-4.3.4/src/lib/y2firewall/dialogs/change_zone.rb 2020-08-13 09:59:42.000000000 +0200 +++ new/yast2-firewall-4.3.6/src/lib/y2firewall/dialogs/change_zone.rb 2020-10-13 13:48:47.000000000 +0200 @@ -1,5 +1,3 @@ -# encoding: utf-8 - # Copyright (c) [2018] SUSE LLC # # All Rights Reserved. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-firewall-4.3.4/src/lib/y2firewall/dialogs/main.rb new/yast2-firewall-4.3.6/src/lib/y2firewall/dialogs/main.rb --- old/yast2-firewall-4.3.4/src/lib/y2firewall/dialogs/main.rb 2020-08-13 09:59:42.000000000 +0200 +++ new/yast2-firewall-4.3.6/src/lib/y2firewall/dialogs/main.rb 2020-10-13 13:48:47.000000000 +0200 @@ -1,5 +1,3 @@ -# encoding: utf-8 - # ------------------------------------------------------------------------------ # Copyright (c) 2018 SUSE LLC # @@ -43,11 +41,12 @@ # For applying the changes to the running configuration a reload or # restart need to be applied. # Proposed a service reload by default (bsc#1114673, bsc#1121277) - fw.system_service.reload if fw.system_service && fw.system_service.running? + fw.system_service.reload if fw.system_service&.running? end def should_open_dialog? return true if Yast::Mode.config + super end @@ -125,6 +124,7 @@ # modifications def apply_changes return false if Yast::Mode.config + fw.write_only fw.system_service.save end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-firewall-4.3.4/src/lib/y2firewall/dialogs/modify_zone_interfaces.rb new/yast2-firewall-4.3.6/src/lib/y2firewall/dialogs/modify_zone_interfaces.rb --- old/yast2-firewall-4.3.4/src/lib/y2firewall/dialogs/modify_zone_interfaces.rb 2020-08-13 09:59:42.000000000 +0200 +++ new/yast2-firewall-4.3.6/src/lib/y2firewall/dialogs/modify_zone_interfaces.rb 2020-10-13 13:48:47.000000000 +0200 @@ -1,5 +1,3 @@ -# encoding: utf-8 - # Copyright (c) [2018] SUSE LLC # # All Rights Reserved. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-firewall-4.3.4/src/lib/y2firewall/dialogs/proposal.rb new/yast2-firewall-4.3.6/src/lib/y2firewall/dialogs/proposal.rb --- old/yast2-firewall-4.3.4/src/lib/y2firewall/dialogs/proposal.rb 2020-08-13 09:59:42.000000000 +0200 +++ new/yast2-firewall-4.3.6/src/lib/y2firewall/dialogs/proposal.rb 2020-10-13 13:48:47.000000000 +0200 @@ -1,5 +1,3 @@ -# encoding: utf-8 - # ------------------------------------------------------------------------------ # Copyright (c) 2017 SUSE LLC # diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-firewall-4.3.4/src/lib/y2firewall/dialogs/zone.rb new/yast2-firewall-4.3.6/src/lib/y2firewall/dialogs/zone.rb --- old/yast2-firewall-4.3.4/src/lib/y2firewall/dialogs/zone.rb 2020-08-13 09:59:42.000000000 +0200 +++ new/yast2-firewall-4.3.6/src/lib/y2firewall/dialogs/zone.rb 2020-10-13 13:48:47.000000000 +0200 @@ -1,5 +1,3 @@ -# encoding: utf-8 - # Copyright (c) [2018] SUSE LLC # # All Rights Reserved. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-firewall-4.3.4/src/lib/y2firewall/importer_strategies/firewalld.rb new/yast2-firewall-4.3.6/src/lib/y2firewall/importer_strategies/firewalld.rb --- old/yast2-firewall-4.3.4/src/lib/y2firewall/importer_strategies/firewalld.rb 2020-08-13 09:59:42.000000000 +0200 +++ new/yast2-firewall-4.3.6/src/lib/y2firewall/importer_strategies/firewalld.rb 2020-10-13 13:48:47.000000000 +0200 @@ -1,5 +1,3 @@ -# encoding: utf-8 - # ------------------------------------------------------------------------------ # Copyright (c) 2017 SUSE LLC # @@ -46,6 +44,7 @@ # @return [Boolean] true if imported correctly def import return true if profile.empty? + profile.fetch("zones", []).each do |zone| log.debug "Proccesing zone: #{zone.inspect}" process_zone(zone) @@ -72,6 +71,7 @@ zone = create_zone(zone_definition) if !zone (zone.attributes + zone.relations).each do |key| next if IGNORED_ATTRIBUTES.include?(key.to_s) + zone.public_send("#{key}=", zone_definition[key.to_s]) if zone_definition[key.to_s] end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-firewall-4.3.4/src/lib/y2firewall/importer_strategies/suse_firewall.rb new/yast2-firewall-4.3.6/src/lib/y2firewall/importer_strategies/suse_firewall.rb --- old/yast2-firewall-4.3.4/src/lib/y2firewall/importer_strategies/suse_firewall.rb 2020-08-13 09:59:42.000000000 +0200 +++ new/yast2-firewall-4.3.6/src/lib/y2firewall/importer_strategies/suse_firewall.rb 2020-10-13 13:48:47.000000000 +0200 @@ -1,5 +1,3 @@ -# encoding: utf-8 - # ------------------------------------------------------------------------------ # Copyright (c) 2017 SUSE LLC # @@ -104,7 +102,7 @@ # # @return [Array<String>] not supported properties def unsupported_properties - @profile.keys.select { |k| !SUPPORTED_PROPERTIES.include?(k) } + @profile.keys.reject { |k| SUPPORTED_PROPERTIES.include?(k) } end # It processes the profile configuring the firewalld zones that match @@ -223,6 +221,7 @@ # @return [Array<String>, nil] def ports(zone) return nil unless rpc_ports(zone) || tcp_ports(zone) || udp_ports(zone) + [rpc_ports(zone), tcp_ports(zone), udp_ports(zone)].compact.flatten end @@ -309,6 +308,7 @@ zone_name = profile.fetch("FW_IPSEC_TRUST", "no").downcase return if zone_name == "no" return "int" if zone_name == "yes" + zone_name end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-firewall-4.3.4/src/lib/y2firewall/proposal_settings.rb new/yast2-firewall-4.3.6/src/lib/y2firewall/proposal_settings.rb --- old/yast2-firewall-4.3.4/src/lib/y2firewall/proposal_settings.rb 2020-08-13 09:59:42.000000000 +0200 +++ new/yast2-firewall-4.3.6/src/lib/y2firewall/proposal_settings.rb 2020-10-13 13:48:47.000000000 +0200 @@ -1,5 +1,3 @@ -# encoding: utf-8 - # ------------------------------------------------------------------------------ # Copyright (c) 2017 SUSE LLC # @@ -122,6 +120,17 @@ self.open_vnc = false end + # Return whether the current settings could be a problem for the user to + # login + # + # @return [Boolean] true if the root user uses only public key + # authentication and the system is not accesible through ssh + def access_problem? + return false unless only_public_key_auth + + !(@open_ssh && @enable_sshd) + end + private def load_feature(feature, to, source: global_section) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-firewall-4.3.4/src/lib/y2firewall/summary_presenter.rb new/yast2-firewall-4.3.6/src/lib/y2firewall/summary_presenter.rb --- old/yast2-firewall-4.3.4/src/lib/y2firewall/summary_presenter.rb 2020-08-13 09:59:42.000000000 +0200 +++ new/yast2-firewall-4.3.6/src/lib/y2firewall/summary_presenter.rb 2020-10-13 13:48:47.000000000 +0200 @@ -1,5 +1,3 @@ -# encoding: utf-8 - # ------------------------------------------------------------------------------ # Copyright (c) 2017 SUSE LLC # @@ -92,6 +90,7 @@ case attr_value when Array return "" if attr_value.empty? + attr_value.join(", ") when TrueClass, FalseClass attr_value ? _("Yes") : _("No") @@ -111,6 +110,7 @@ zone_desc = attributes_summary(zone, zone.relations) return "" if zone_desc.empty? + zone_desc = attributes_summary(zone, ZONE_ATTRS) + zone_desc zone_header(zone) + list(zone_desc) @@ -118,6 +118,7 @@ def attributes_summary(zone, attributes) raise ArgumentError, "zone parameter has to be defined" if zone.nil? + attributes.each_with_object([]) do |attribute, memo| text = zone_detail_summary(attribute, zone.public_send(attribute)) (memo << text) unless text.empty? diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-firewall-4.3.4/src/lib/y2firewall/ui_state.rb new/yast2-firewall-4.3.6/src/lib/y2firewall/ui_state.rb --- old/yast2-firewall-4.3.4/src/lib/y2firewall/ui_state.rb 2020-08-13 09:59:42.000000000 +0200 +++ new/yast2-firewall-4.3.6/src/lib/y2firewall/ui_state.rb 2020-10-13 13:48:47.000000000 +0200 @@ -1,5 +1,3 @@ -# encoding: utf-8 - # Copyright (c) [2018] SUSE LLC # # All Rights Reserved. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-firewall-4.3.4/src/lib/y2firewall/widgets/allowed_services.rb new/yast2-firewall-4.3.6/src/lib/y2firewall/widgets/allowed_services.rb --- old/yast2-firewall-4.3.4/src/lib/y2firewall/widgets/allowed_services.rb 2020-08-13 09:59:42.000000000 +0200 +++ new/yast2-firewall-4.3.6/src/lib/y2firewall/widgets/allowed_services.rb 2020-10-13 13:48:47.000000000 +0200 @@ -1,5 +1,3 @@ -# encoding: utf-8 - # Copyright (c) [2018] SUSE LLC # # All Rights Reserved. @@ -98,6 +96,7 @@ return true unless Yast::UI.TextMode return true if selected_services.empty? + # TRANSLATORS: popup question msg = _("The selection of services will be lost if you leave the page\n" \ "without moving them with Add/Remove.\n\nDo you really want to continue?\n") diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-firewall-4.3.4/src/lib/y2firewall/widgets/change_zone_button.rb new/yast2-firewall-4.3.6/src/lib/y2firewall/widgets/change_zone_button.rb --- old/yast2-firewall-4.3.4/src/lib/y2firewall/widgets/change_zone_button.rb 2020-08-13 09:59:42.000000000 +0200 +++ new/yast2-firewall-4.3.6/src/lib/y2firewall/widgets/change_zone_button.rb 2020-10-13 13:48:47.000000000 +0200 @@ -1,5 +1,3 @@ -# encoding: utf-8 - # Copyright (c) [2018] SUSE LLC # # All Rights Reserved. @@ -47,8 +45,9 @@ # @macro seeAbstractWidget def handle return nil unless interface + result = Dialogs::ChangeZone.run(interface) - result == :ok ? :redraw : nil + (result == :ok) ? :redraw : nil end end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-firewall-4.3.4/src/lib/y2firewall/widgets/default_zone_button.rb new/yast2-firewall-4.3.6/src/lib/y2firewall/widgets/default_zone_button.rb --- old/yast2-firewall-4.3.4/src/lib/y2firewall/widgets/default_zone_button.rb 2020-08-13 09:59:42.000000000 +0200 +++ new/yast2-firewall-4.3.6/src/lib/y2firewall/widgets/default_zone_button.rb 2020-10-13 13:48:47.000000000 +0200 @@ -1,5 +1,3 @@ -# encoding: utf-8 - # Copyright (c) [2018] SUSE LLC # # All Rights Reserved. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-firewall-4.3.4/src/lib/y2firewall/widgets/interfaces_table.rb new/yast2-firewall-4.3.6/src/lib/y2firewall/widgets/interfaces_table.rb --- old/yast2-firewall-4.3.4/src/lib/y2firewall/widgets/interfaces_table.rb 2020-08-13 09:59:42.000000000 +0200 +++ new/yast2-firewall-4.3.6/src/lib/y2firewall/widgets/interfaces_table.rb 2020-10-13 13:48:47.000000000 +0200 @@ -1,5 +1,3 @@ -# encoding: utf-8 - # Copyright (c) [2018] SUSE LLC # # All Rights Reserved. @@ -55,9 +53,7 @@ # @macro seeAbstractWidget def init interface = Y2Firewall::UIState.instance.row_id - if interface && interfaces.map(&:id).include?(interface) - self.value = interface - end + self.value = interface if interface && interfaces.map(&:id).include?(interface) change_zone_button.interface = selected_interface end @@ -85,6 +81,7 @@ # @macro seeAbstractWidget def handle(event) return nil unless my_event?(event) && event["EventReason"] == "SelectionChanged" + UIState.instance.select_row(value) change_zone_button.interface = selected_interface nil diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-firewall-4.3.4/src/lib/y2firewall/widgets/modify_zone_interfaces.rb new/yast2-firewall-4.3.6/src/lib/y2firewall/widgets/modify_zone_interfaces.rb --- old/yast2-firewall-4.3.4/src/lib/y2firewall/widgets/modify_zone_interfaces.rb 2020-08-13 09:59:42.000000000 +0200 +++ new/yast2-firewall-4.3.6/src/lib/y2firewall/widgets/modify_zone_interfaces.rb 2020-10-13 13:48:47.000000000 +0200 @@ -1,5 +1,3 @@ -# encoding: utf-8 - # Copyright (c) [2018] SUSE LLC # # All Rights Reserved. @@ -69,6 +67,7 @@ # @macro seeAbstractWidget def store return unless selected_zone + selected_zone.interfaces = interfaces_input.items_from_ui end @@ -88,6 +87,7 @@ # @return [Y2Firewall::Firewalld::Zone,nil] selected zone def selected_zone return nil if !value || value.empty? + Y2Firewall::Firewalld.instance.find_zone(value) end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-firewall-4.3.4/src/lib/y2firewall/widgets/overview_tree.rb new/yast2-firewall-4.3.6/src/lib/y2firewall/widgets/overview_tree.rb --- old/yast2-firewall-4.3.4/src/lib/y2firewall/widgets/overview_tree.rb 2020-08-13 09:59:42.000000000 +0200 +++ new/yast2-firewall-4.3.6/src/lib/y2firewall/widgets/overview_tree.rb 2020-10-13 13:48:47.000000000 +0200 @@ -1,5 +1,3 @@ -# encoding: utf-8 - # ------------------------------------------------------------------------------ # Copyright (c) 2018 SUSE LLC # diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-firewall-4.3.4/src/lib/y2firewall/widgets/overview_tree_pager.rb new/yast2-firewall-4.3.6/src/lib/y2firewall/widgets/overview_tree_pager.rb --- old/yast2-firewall-4.3.4/src/lib/y2firewall/widgets/overview_tree_pager.rb 2020-08-13 09:59:42.000000000 +0200 +++ new/yast2-firewall-4.3.6/src/lib/y2firewall/widgets/overview_tree_pager.rb 2020-10-13 13:48:47.000000000 +0200 @@ -1,5 +1,3 @@ -# encoding: utf-8 - # Copyright (c) [2018] SUSE LLC # # All Rights Reserved. @@ -73,6 +71,7 @@ # @return [CWM::PagerTreeItem] def startup_item return nil if Yast::Mode.config + page = Pages::Startup.new(self) CWM::PagerTreeItem.new(page) end @@ -92,8 +91,8 @@ end # @return [CWM::PagerTreeItem] - def zone_item(z) - page = Pages::Zone.new(z, self) + def zone_item(zone) + page = Pages::Zone.new(zone, self) CWM::PagerTreeItem.new(page) end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-firewall-4.3.4/src/lib/y2firewall/widgets/pages/interfaces.rb new/yast2-firewall-4.3.6/src/lib/y2firewall/widgets/pages/interfaces.rb --- old/yast2-firewall-4.3.4/src/lib/y2firewall/widgets/pages/interfaces.rb 2020-08-13 09:59:42.000000000 +0200 +++ new/yast2-firewall-4.3.6/src/lib/y2firewall/widgets/pages/interfaces.rb 2020-10-13 13:48:47.000000000 +0200 @@ -1,5 +1,3 @@ -# encoding: utf-8 - # ------------------------------------------------------------------------------ # Copyright (c) 2018 SUSE LLC # @@ -50,6 +48,7 @@ # @macro seeCustomWidget def contents return @contents if @contents + @contents = VBox( Left(Heading(_("Interfaces"))), interfaces_table, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-firewall-4.3.4/src/lib/y2firewall/widgets/pages/startup.rb new/yast2-firewall-4.3.6/src/lib/y2firewall/widgets/pages/startup.rb --- old/yast2-firewall-4.3.4/src/lib/y2firewall/widgets/pages/startup.rb 2020-08-13 09:59:42.000000000 +0200 +++ new/yast2-firewall-4.3.6/src/lib/y2firewall/widgets/pages/startup.rb 2020-10-13 13:48:47.000000000 +0200 @@ -1,5 +1,3 @@ -# encoding: utf-8 - # ------------------------------------------------------------------------------ # Copyright (c) 2018 SUSE LLC # diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-firewall-4.3.4/src/lib/y2firewall/widgets/pages/zone.rb new/yast2-firewall-4.3.6/src/lib/y2firewall/widgets/pages/zone.rb --- old/yast2-firewall-4.3.4/src/lib/y2firewall/widgets/pages/zone.rb 2020-08-13 09:59:42.000000000 +0200 +++ new/yast2-firewall-4.3.6/src/lib/y2firewall/widgets/pages/zone.rb 2020-10-13 13:48:47.000000000 +0200 @@ -1,5 +1,3 @@ -# encoding: utf-8 - # ------------------------------------------------------------------------------ # Copyright (c) 2018 SUSE LLC # @@ -138,6 +136,7 @@ values_by_proto.each do |proto_sym, ranges| invalid_range = ranges.find { |r| !valid_range?(r) } next unless invalid_range + Yast::UI.SetFocus(Id(proto_sym)) err_msg = format(_("Invalid port range: %s"), invalid_range) Yast::Popup.Error(err_msg + "\n" + valid_port_description) @@ -156,13 +155,13 @@ end end - def valid_range?(r) - r =~ /\d+/ || r =~ /\d+-\d+/ + def valid_range?(range) + range =~ /\d+/ || range =~ /\d+-\d+/ end - def items_from_ui(s) + def items_from_ui(str) # the separator is at least one comma or space, surrounded by optional spaces - s.split(/ *[, ] */) + str.split(/ *[, ] */) end # @param hash [Hash{Symbol => Array<String>}] ports specification @@ -177,7 +176,7 @@ hash.map { |sym, ports| ports.map { |p| "#{p}/#{sym}" } }.flatten end - # @param a [Array] ports specification + # @param ports_list [Array] ports specification # as array from {Y2Firewall::Firewalld::Zone#ports} # @return [Hash{Symbol => Array<String>}] ports specification # categorized by protocol @@ -185,8 +184,8 @@ # a = ["55555-55666/tcp", "44444/tcp", "33333/udp"] # h = { tcp: ["55555-55666", "44444"], udp: ["33333"] } # ports_from_array(a) # => h - def ports_from_array(a) - a + def ports_from_array(ports_list) + ports_list .map { |p| p.split("/") } .each_with_object({}) do |i, acc| ports, proto = *i diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-firewall-4.3.4/src/lib/y2firewall/widgets/pages/zones.rb new/yast2-firewall-4.3.6/src/lib/y2firewall/widgets/pages/zones.rb --- old/yast2-firewall-4.3.4/src/lib/y2firewall/widgets/pages/zones.rb 2020-08-13 09:59:42.000000000 +0200 +++ new/yast2-firewall-4.3.6/src/lib/y2firewall/widgets/pages/zones.rb 2020-10-13 13:48:47.000000000 +0200 @@ -1,5 +1,3 @@ -# encoding: utf-8 - # ------------------------------------------------------------------------------ # Copyright (c) 2018 SUSE LLC # @@ -54,6 +52,7 @@ # @macro seeCustomWidget def contents return @contents if @contents + @contents = VBox( Left(Heading(_("Zones"))), zones_table, @@ -101,7 +100,7 @@ result = Dialogs::Zone.run(zone) UIState.instance.select_row(name) if result == :ok - result == :ok ? :redraw : nil + (result == :ok) ? :redraw : nil end end @@ -132,6 +131,7 @@ def default_zone_button return nil if firewall.zones.empty? + @default_zone_button ||= DefaultZoneButton.new(firewall.zones.first) end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-firewall-4.3.4/src/lib/y2firewall/widgets/pages.rb new/yast2-firewall-4.3.6/src/lib/y2firewall/widgets/pages.rb --- old/yast2-firewall-4.3.4/src/lib/y2firewall/widgets/pages.rb 2020-08-13 09:59:42.000000000 +0200 +++ new/yast2-firewall-4.3.6/src/lib/y2firewall/widgets/pages.rb 2020-10-13 13:48:47.000000000 +0200 @@ -1,5 +1,3 @@ -# encoding: utf-8 - # ------------------------------------------------------------------------------ # Copyright (c) 2018 SUSE LLC # diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-firewall-4.3.4/src/lib/y2firewall/widgets/proposal.rb new/yast2-firewall-4.3.6/src/lib/y2firewall/widgets/proposal.rb --- old/yast2-firewall-4.3.4/src/lib/y2firewall/widgets/proposal.rb 2020-08-13 09:59:42.000000000 +0200 +++ new/yast2-firewall-4.3.6/src/lib/y2firewall/widgets/proposal.rb 2020-10-13 13:48:47.000000000 +0200 @@ -1,5 +1,3 @@ -# encoding: utf-8 - # ------------------------------------------------------------------------------ # Copyright (c) 2017 SUSE LLC # diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-firewall-4.3.4/src/lib/y2firewall/widgets/services_table.rb new/yast2-firewall-4.3.6/src/lib/y2firewall/widgets/services_table.rb --- old/yast2-firewall-4.3.4/src/lib/y2firewall/widgets/services_table.rb 2020-08-13 09:59:42.000000000 +0200 +++ new/yast2-firewall-4.3.6/src/lib/y2firewall/widgets/services_table.rb 2020-10-13 13:48:47.000000000 +0200 @@ -1,5 +1,3 @@ -# encoding: utf-8 - # Copyright (c) [2018] SUSE LLC # # All Rights Reserved. @@ -74,10 +72,11 @@ old_services = @services @services = services change_items(items) - unless Yast::UI.TextMode - new_services = services - old_services - self.value = new_services - end + + return if Yast::UI.TextMode + + new_services = services - old_services + self.value = new_services end end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-firewall-4.3.4/src/lib/y2firewall/widgets/zone.rb new/yast2-firewall-4.3.6/src/lib/y2firewall/widgets/zone.rb --- old/yast2-firewall-4.3.4/src/lib/y2firewall/widgets/zone.rb 2020-08-13 09:59:42.000000000 +0200 +++ new/yast2-firewall-4.3.6/src/lib/y2firewall/widgets/zone.rb 2020-10-13 13:48:47.000000000 +0200 @@ -1,5 +1,3 @@ -# encoding: utf-8 - # Copyright (c) [2017] SUSE LLC # # All Rights Reserved. @@ -176,7 +174,7 @@ "IP Masquerade, also called IPMASQ or MASQ, allows one or more computers in " \ "a network without assigned IP addresses to communicate using server’s" \ "assigned IP address." - ), + ), label) end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-firewall-4.3.4/src/lib/y2firewall/widgets/zone_button.rb new/yast2-firewall-4.3.6/src/lib/y2firewall/widgets/zone_button.rb --- old/yast2-firewall-4.3.4/src/lib/y2firewall/widgets/zone_button.rb 2020-08-13 09:59:42.000000000 +0200 +++ new/yast2-firewall-4.3.6/src/lib/y2firewall/widgets/zone_button.rb 2020-10-13 13:48:47.000000000 +0200 @@ -1,5 +1,3 @@ -# encoding: utf-8 - # ------------------------------------------------------------------------------ # Copyright (c) 2018 SUSE LLC # diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-firewall-4.3.4/src/lib/y2firewall/widgets/zone_interfaces_button.rb new/yast2-firewall-4.3.6/src/lib/y2firewall/widgets/zone_interfaces_button.rb --- old/yast2-firewall-4.3.4/src/lib/y2firewall/widgets/zone_interfaces_button.rb 2020-08-13 09:59:42.000000000 +0200 +++ new/yast2-firewall-4.3.6/src/lib/y2firewall/widgets/zone_interfaces_button.rb 2020-10-13 13:48:47.000000000 +0200 @@ -1,5 +1,3 @@ -# encoding: utf-8 - # Copyright (c) [2018] SUSE LLC # # All Rights Reserved. @@ -44,7 +42,7 @@ # @macro seeAbstractWidget def handle result = Dialogs::ModifyZoneInterfaces.run - result == :ok ? :redraw : nil + (result == :ok) ? :redraw : nil end end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-firewall-4.3.4/src/lib/y2firewall/widgets/zone_options.rb new/yast2-firewall-4.3.6/src/lib/y2firewall/widgets/zone_options.rb --- old/yast2-firewall-4.3.4/src/lib/y2firewall/widgets/zone_options.rb 2020-08-13 09:59:42.000000000 +0200 +++ new/yast2-firewall-4.3.6/src/lib/y2firewall/widgets/zone_options.rb 2020-10-13 13:48:47.000000000 +0200 @@ -1,5 +1,3 @@ -# encoding: utf-8 - # Copyright (c) [2018] SUSE LLC # # All Rights Reserved. @@ -45,6 +43,7 @@ # @macro seeAbstractWidget def init return unless interface.zone + self.value = interface.zone.name end @@ -61,11 +60,11 @@ # @macro seeAbstractWidget def store new_zone = selected_zone - return if new_zone && new_zone.interfaces.include?(interface.name) + return if new_zone&.interfaces&.include?(interface.name) old_zone = interface.zone - old_zone.remove_interface(interface.name) if old_zone - new_zone.add_interface(interface.name) if new_zone + old_zone&.remove_interface(interface.name) + new_zone&.add_interface(interface.name) end private @@ -84,6 +83,7 @@ # @return [Y2Firewall::Firewalld::Zone,nil] selected zone def selected_zone return nil if value.empty? + Y2Firewall::Firewalld.instance.find_zone(value) end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-firewall-4.3.4/src/lib/y2firewall/widgets/zones_table.rb new/yast2-firewall-4.3.6/src/lib/y2firewall/widgets/zones_table.rb --- old/yast2-firewall-4.3.4/src/lib/y2firewall/widgets/zones_table.rb 2020-08-13 09:59:42.000000000 +0200 +++ new/yast2-firewall-4.3.6/src/lib/y2firewall/widgets/zones_table.rb 2020-10-13 13:48:47.000000000 +0200 @@ -1,5 +1,3 @@ -# encoding: utf-8 - # Copyright (c) [2018] SUSE LLC # # All Rights Reserved. @@ -83,6 +81,7 @@ # @macro seeAbstractWidget def handle(event) return nil unless event["EventReason"] == "SelectionChanged" + UIState.instance.select_row(value) update_default_zone_button nil diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-firewall-4.3.4/test/lib/y2firewall/autoyast_test.rb new/yast2-firewall-4.3.6/test/lib/y2firewall/autoyast_test.rb --- old/yast2-firewall-4.3.4/test/lib/y2firewall/autoyast_test.rb 2020-08-13 09:59:42.000000000 +0200 +++ new/yast2-firewall-4.3.6/test/lib/y2firewall/autoyast_test.rb 2020-10-13 13:48:47.000000000 +0200 @@ -66,8 +66,8 @@ " sources:"] end - let(:known_zones) { %w(dmz drop external home internal public trusted work) } - let(:known_services) { %w(http https samba ssh) } + let(:known_zones) { %w[dmz drop external home internal public trusted work] } + let(:known_services) { %w[http https samba ssh] } let(:api) do instance_double(Y2Firewall::Firewalld::Api, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-firewall-4.3.4/test/lib/y2firewall/clients/auto_test.rb new/yast2-firewall-4.3.6/test/lib/y2firewall/clients/auto_test.rb --- old/yast2-firewall-4.3.4/test/lib/y2firewall/clients/auto_test.rb 2020-08-13 09:59:42.000000000 +0200 +++ new/yast2-firewall-4.3.6/test/lib/y2firewall/clients/auto_test.rb 2020-10-13 13:48:47.000000000 +0200 @@ -327,8 +327,8 @@ { "FW_MASQUERADE" => "yes", "enable_firewall" => false, "start_firewall" => false } end - let(:known_zones) { %w(dmz external) } - let(:known_services) { %w(http https samba ssh) } + let(:known_zones) { %w[dmz external] } + let(:known_services) { %w[http https samba ssh] } let(:zones_definition) do ["dmz", diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-firewall-4.3.4/test/lib/y2firewall/clients/firewall_test.rb new/yast2-firewall-4.3.6/test/lib/y2firewall/clients/firewall_test.rb --- old/yast2-firewall-4.3.4/test/lib/y2firewall/clients/firewall_test.rb 2020-08-13 09:59:42.000000000 +0200 +++ new/yast2-firewall-4.3.6/test/lib/y2firewall/clients/firewall_test.rb 2020-10-13 13:48:47.000000000 +0200 @@ -30,7 +30,7 @@ allow(Yast::PackageSystem).to receive("CheckAndInstallPackages") .with(["firewalld"]).and_return(installed) allow(Yast::WFM).to receive("Args").and_return(args) - allow($stderr).to receive(:puts) + allow(subject).to receive(:warn) end context "when the firewalld package is not installed" do @@ -44,7 +44,7 @@ let(:args) { ["list"] } it "recommends to use the firewalld cmdline clients" do - expect($stderr).to receive(:puts).with(Y2Firewall::Clients::Firewall::NOT_SUPPORTED) + expect(subject).to receive(:warn).with(Y2Firewall::Clients::Firewall::NOT_SUPPORTED) subject.run end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-firewall-4.3.4/test/lib/y2firewall/clients/proposal_test.rb new/yast2-firewall-4.3.6/test/lib/y2firewall/clients/proposal_test.rb --- old/yast2-firewall-4.3.4/test/lib/y2firewall/clients/proposal_test.rb 2020-08-13 09:59:42.000000000 +0200 +++ new/yast2-firewall-4.3.6/test/lib/y2firewall/clients/proposal_test.rb 2020-10-13 13:48:47.000000000 +0200 @@ -1,6 +1,4 @@ #!/usr/bin/env rspec -# encoding: utf-8 - # Copyright (c) [2017] SUSE LLC # # All Rights Reserved. @@ -93,11 +91,12 @@ describe "#make_proposal" do let(:firewall_enabled) { false } + before do allow(proposal_settings).to receive("enable_firewall").and_return(firewall_enabled) end - it "returns a hash with 'preformatted_proposal', 'links' and 'warning_level'" do + it "returns a hash with 'preformatted_proposal', 'links', 'warning_level' and 'warning'" do allow(Yast::HTML).to receive("List").and_return("<ul><li>Proposal link</li></ul>") proposal = client.make_proposal({}) @@ -122,5 +121,42 @@ expect(proposal["preformatted_proposal"]).to include("port") end end + + context "when the user uses only SSH key based authentication" do + let(:ssh_enabled) { true } + let(:ssh_open) { true } + + before do + allow(proposal_settings).to receive(:only_public_key_auth).and_return(true) + proposal_settings.enable_sshd = ssh_enabled + proposal_settings.open_ssh = ssh_open + end + + context "and the SSH service is enabled" do + context "and the SSH port is open" do + it "the 'proposal' does not contain a warning message" do + proposal = client.make_proposal({}) + expect(proposal["warning"]).to be_nil + end + end + context "and the SSH port is close" do + let(:ssh_open) { false } + + it "returns the proposal warning about the situation" do + proposal = client.make_proposal({}) + expect(proposal["warning"]).to include("might not be allowed") + end + end + end + + context "and the SSH is disabled" do + let(:ssh_enabled) { false } + + it "returns the proposal warning about the situation" do + proposal = client.make_proposal({}) + expect(proposal["warning"]).to include("might not be allowed") + end + end + end end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-firewall-4.3.4/test/lib/y2firewall/dialogs/change_zone_test.rb new/yast2-firewall-4.3.6/test/lib/y2firewall/dialogs/change_zone_test.rb --- old/yast2-firewall-4.3.4/test/lib/y2firewall/dialogs/change_zone_test.rb 2020-08-13 09:59:42.000000000 +0200 +++ new/yast2-firewall-4.3.6/test/lib/y2firewall/dialogs/change_zone_test.rb 2020-10-13 13:48:47.000000000 +0200 @@ -1,6 +1,4 @@ #!/usr/bin/env rspec -# encoding: utf-8 - # Copyright (c) [2018] SUSE LLC # # All Rights Reserved. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-firewall-4.3.4/test/lib/y2firewall/dialogs/zone_test.rb new/yast2-firewall-4.3.6/test/lib/y2firewall/dialogs/zone_test.rb --- old/yast2-firewall-4.3.4/test/lib/y2firewall/dialogs/zone_test.rb 2020-08-13 09:59:42.000000000 +0200 +++ new/yast2-firewall-4.3.6/test/lib/y2firewall/dialogs/zone_test.rb 2020-10-13 13:48:47.000000000 +0200 @@ -1,6 +1,4 @@ #!/usr/bin/env rspec -# encoding: utf-8 - # Copyright (c) [2018] SUSE LLC # # All Rights Reserved. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-firewall-4.3.4/test/lib/y2firewall/proposal_settings_test.rb new/yast2-firewall-4.3.6/test/lib/y2firewall/proposal_settings_test.rb --- old/yast2-firewall-4.3.4/test/lib/y2firewall/proposal_settings_test.rb 2020-08-13 09:59:42.000000000 +0200 +++ new/yast2-firewall-4.3.6/test/lib/y2firewall/proposal_settings_test.rb 2020-10-13 13:48:47.000000000 +0200 @@ -206,4 +206,50 @@ expect(subject.open_vnc).to be(false) end end + + describe "#access_problem?" do + let(:ssh_enabled) { true } + let(:ssh_open) { true } + let(:only_ssh_key_auth) { true } + + before do + subject.enable_sshd = ssh_enabled + subject.open_ssh = ssh_open + allow(subject).to receive(:only_public_key_auth).and_return(only_ssh_key_auth) + end + + context "when the root user uses only SSH key based authentication" do + context "when sshd is enabled" do + context "and the SSH port is open" do + it "returns false" do + expect(subject.access_problem?).to eql(false) + end + end + + context "and the SSH port is close" do + let(:ssh_open) { false } + + it "returns true" do + expect(subject.access_problem?).to eql(true) + end + end + end + + context "when sshd is disabled" do + let(:ssh_enabled) { false } + + it "returns true" do + expect(subject.access_problem?).to eql(true) + end + end + end + + context "when the root user uses password authentication" do + let(:only_ssh_key_auth) { false } + + it "returns false" do + expect(subject.access_problem?).to eql(false) + end + end + end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-firewall-4.3.4/test/lib/y2firewall/summary_presenter_test.rb new/yast2-firewall-4.3.6/test/lib/y2firewall/summary_presenter_test.rb --- old/yast2-firewall-4.3.4/test/lib/y2firewall/summary_presenter_test.rb 2020-08-13 09:59:42.000000000 +0200 +++ new/yast2-firewall-4.3.6/test/lib/y2firewall/summary_presenter_test.rb 2020-10-13 13:48:47.000000000 +0200 @@ -1,6 +1,4 @@ #!/usr/bin/env rspec -# encoding: utf-8 - # Copyright (c) [2018] SUSE LLC # # All Rights Reserved. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-firewall-4.3.4/test/lib/y2firewall/widgets/allowed_services_test.rb new/yast2-firewall-4.3.6/test/lib/y2firewall/widgets/allowed_services_test.rb --- old/yast2-firewall-4.3.4/test/lib/y2firewall/widgets/allowed_services_test.rb 2020-08-13 09:59:42.000000000 +0200 +++ new/yast2-firewall-4.3.6/test/lib/y2firewall/widgets/allowed_services_test.rb 2020-10-13 13:48:47.000000000 +0200 @@ -1,6 +1,4 @@ #!/usr/bin/env rspec -# encoding: utf-8 - # Copyright (c) [2018] SUSE LLC # # All Rights Reserved. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-firewall-4.3.4/test/lib/y2firewall/widgets/change_zone_button_test.rb new/yast2-firewall-4.3.6/test/lib/y2firewall/widgets/change_zone_button_test.rb --- old/yast2-firewall-4.3.4/test/lib/y2firewall/widgets/change_zone_button_test.rb 2020-08-13 09:59:42.000000000 +0200 +++ new/yast2-firewall-4.3.6/test/lib/y2firewall/widgets/change_zone_button_test.rb 2020-10-13 13:48:47.000000000 +0200 @@ -1,6 +1,4 @@ #!/usr/bin/env rspec -# encoding: utf-8 - # Copyright (c) [2018] SUSE LLC # # All Rights Reserved. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-firewall-4.3.4/test/lib/y2firewall/widgets/default_zone_button_test.rb new/yast2-firewall-4.3.6/test/lib/y2firewall/widgets/default_zone_button_test.rb --- old/yast2-firewall-4.3.4/test/lib/y2firewall/widgets/default_zone_button_test.rb 2020-08-13 09:59:42.000000000 +0200 +++ new/yast2-firewall-4.3.6/test/lib/y2firewall/widgets/default_zone_button_test.rb 2020-10-13 13:48:47.000000000 +0200 @@ -1,6 +1,4 @@ #!/usr/bin/env rspec -# encoding: utf-8 - # Copyright (c) [2018] SUSE LLC # # All Rights Reserved. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-firewall-4.3.4/test/lib/y2firewall/widgets/interfaces_table_test.rb new/yast2-firewall-4.3.6/test/lib/y2firewall/widgets/interfaces_table_test.rb --- old/yast2-firewall-4.3.4/test/lib/y2firewall/widgets/interfaces_table_test.rb 2020-08-13 09:59:42.000000000 +0200 +++ new/yast2-firewall-4.3.6/test/lib/y2firewall/widgets/interfaces_table_test.rb 2020-10-13 13:48:47.000000000 +0200 @@ -1,6 +1,4 @@ #!/usr/bin/env rspec -# encoding: utf-8 - # Copyright (c) [2018] SUSE LLC # # All Rights Reserved. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-firewall-4.3.4/test/lib/y2firewall/widgets/modify_zone_interfaces_test.rb new/yast2-firewall-4.3.6/test/lib/y2firewall/widgets/modify_zone_interfaces_test.rb --- old/yast2-firewall-4.3.4/test/lib/y2firewall/widgets/modify_zone_interfaces_test.rb 2020-08-13 09:59:42.000000000 +0200 +++ new/yast2-firewall-4.3.6/test/lib/y2firewall/widgets/modify_zone_interfaces_test.rb 2020-10-13 13:48:47.000000000 +0200 @@ -1,6 +1,4 @@ #!/usr/bin/env rspec -# encoding: utf-8 - # Copyright (c) [2018] SUSE LLC # # All Rights Reserved. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-firewall-4.3.4/test/lib/y2firewall/widgets/overview_tree_pager_test.rb new/yast2-firewall-4.3.6/test/lib/y2firewall/widgets/overview_tree_pager_test.rb --- old/yast2-firewall-4.3.4/test/lib/y2firewall/widgets/overview_tree_pager_test.rb 2020-08-13 09:59:42.000000000 +0200 +++ new/yast2-firewall-4.3.6/test/lib/y2firewall/widgets/overview_tree_pager_test.rb 2020-10-13 13:48:47.000000000 +0200 @@ -1,6 +1,4 @@ #!/usr/bin/env rspec -# encoding: utf-8 - # Copyright (c) [2018] SUSE LLC # # All Rights Reserved. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-firewall-4.3.4/test/lib/y2firewall/widgets/overview_tree_test.rb new/yast2-firewall-4.3.6/test/lib/y2firewall/widgets/overview_tree_test.rb --- old/yast2-firewall-4.3.4/test/lib/y2firewall/widgets/overview_tree_test.rb 2020-08-13 09:59:42.000000000 +0200 +++ new/yast2-firewall-4.3.6/test/lib/y2firewall/widgets/overview_tree_test.rb 2020-10-13 13:48:47.000000000 +0200 @@ -1,6 +1,4 @@ #!/usr/bin/env rspec -# encoding: utf-8 - # Copyright (c) [2018] SUSE LLC # # All Rights Reserved. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-firewall-4.3.4/test/lib/y2firewall/widgets/pages/interfaces_test.rb new/yast2-firewall-4.3.6/test/lib/y2firewall/widgets/pages/interfaces_test.rb --- old/yast2-firewall-4.3.4/test/lib/y2firewall/widgets/pages/interfaces_test.rb 2020-08-13 09:59:42.000000000 +0200 +++ new/yast2-firewall-4.3.6/test/lib/y2firewall/widgets/pages/interfaces_test.rb 2020-10-13 13:48:47.000000000 +0200 @@ -1,6 +1,4 @@ #!/usr/bin/env rspec -# encoding: utf-8 - # Copyright (c) [2018] SUSE LLC # # All Rights Reserved. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-firewall-4.3.4/test/lib/y2firewall/widgets/proposal_test.rb new/yast2-firewall-4.3.6/test/lib/y2firewall/widgets/proposal_test.rb --- old/yast2-firewall-4.3.4/test/lib/y2firewall/widgets/proposal_test.rb 2020-08-13 09:59:42.000000000 +0200 +++ new/yast2-firewall-4.3.6/test/lib/y2firewall/widgets/proposal_test.rb 2020-10-13 13:48:47.000000000 +0200 @@ -24,11 +24,6 @@ require "y2firewall/widgets/proposal" require "y2firewall/proposal_settings" -RSpec.shared_examples "CWM::CheckBox" do - include_examples "CWM::AbstractWidget" - include_examples "CWM::ValueBasedWidget" -end - describe Y2Firewall::Widgets do let(:proposal_settings) do instance_double( diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-firewall-4.3.4/test/lib/y2firewall/widgets/services_table_test.rb new/yast2-firewall-4.3.6/test/lib/y2firewall/widgets/services_table_test.rb --- old/yast2-firewall-4.3.4/test/lib/y2firewall/widgets/services_table_test.rb 2020-08-13 09:59:42.000000000 +0200 +++ new/yast2-firewall-4.3.6/test/lib/y2firewall/widgets/services_table_test.rb 2020-10-13 13:48:47.000000000 +0200 @@ -1,6 +1,4 @@ #!/usr/bin/env rspec -# encoding: utf-8 - # Copyright (c) [2018] SUSE LLC # # All Rights Reserved. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-firewall-4.3.4/test/lib/y2firewall/widgets/zone_options_test.rb new/yast2-firewall-4.3.6/test/lib/y2firewall/widgets/zone_options_test.rb --- old/yast2-firewall-4.3.4/test/lib/y2firewall/widgets/zone_options_test.rb 2020-08-13 09:59:42.000000000 +0200 +++ new/yast2-firewall-4.3.6/test/lib/y2firewall/widgets/zone_options_test.rb 2020-10-13 13:48:47.000000000 +0200 @@ -1,6 +1,4 @@ #!/usr/bin/env rspec -# encoding: utf-8 - # Copyright (c) [2018] SUSE LLC # # All Rights Reserved. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-firewall-4.3.4/test/lib/y2firewall/widgets/zone_test.rb new/yast2-firewall-4.3.6/test/lib/y2firewall/widgets/zone_test.rb --- old/yast2-firewall-4.3.4/test/lib/y2firewall/widgets/zone_test.rb 2020-08-13 09:59:42.000000000 +0200 +++ new/yast2-firewall-4.3.6/test/lib/y2firewall/widgets/zone_test.rb 2020-10-13 13:48:47.000000000 +0200 @@ -1,6 +1,4 @@ #!/usr/bin/env rspec -# encoding: utf-8 - # Copyright (c) [2018] SUSE LLC # # All Rights Reserved. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-firewall-4.3.4/test/test_helper.rb new/yast2-firewall-4.3.6/test/test_helper.rb --- old/yast2-firewall-4.3.4/test/test_helper.rb 2020-08-13 09:59:42.000000000 +0200 +++ new/yast2-firewall-4.3.6/test/test_helper.rb 2020-10-13 13:48:47.000000000 +0200 @@ -1,5 +1,3 @@ -# encoding: utf-8 - # ------------------------------------------------------------------------------ # Copyright (c) 2017 SUSE LLC # @@ -20,7 +18,7 @@ # ------------------------------------------------------------------------------ # Set the paths -srcdir = File.expand_path("../../src", __FILE__) +srcdir = File.expand_path("../src", __dir__) y2dirs = ENV.fetch("Y2DIR", "").split(":") ENV["Y2DIR"] = y2dirs.unshift(srcdir).join(":") @@ -39,6 +37,8 @@ # rubocop:disable Style/SingleLineMethods # rubocop:disable Style/MethodName stub_module("UsersSimple", Class.new { def self.GetRootPassword; "secret"; end }) +# rubocop:enable Style/SingleLineMethods +# rubocop:enable Style/MethodName # some tests have translatable messages ENV["LANG"] = "en_US.UTF-8"