diff --git a/package/yast2-firewall.changes b/package/yast2-firewall.changes index fe1f730..69b7caf 100644 --- a/package/yast2-firewall.changes +++ b/package/yast2-firewall.changes @@ -1,3 +1,11 @@ +------------------------------------------------------------------- +Tue Aug 6 11:29:06 UTC 2024 - Knut Anderssen + +- In case of autoinstallation keep the firewall service state in + the Installation::SecuritySettings for not conflicting with the + proposal (bsc#1216615) +- 5.0.1 + ------------------------------------------------------------------- Wed Aug 30 20:16:10 UTC 2023 - Josef Reidinger diff --git a/package/yast2-firewall.spec b/package/yast2-firewall.spec index a5088b2..a67bcb8 100644 --- a/package/yast2-firewall.spec +++ b/package/yast2-firewall.spec @@ -17,7 +17,7 @@ Name: yast2-firewall -Version: 5.0.0 +Version: 5.0.1 Release: 0 Summary: YaST2 - Firewall Configuration Group: System/YaST diff --git a/src/lib/y2firewall/clients/auto.rb b/src/lib/y2firewall/clients/auto.rb index 6b65eff..c347cca 100644 --- a/src/lib/y2firewall/clients/auto.rb +++ b/src/lib/y2firewall/clients/auto.rb @@ -80,10 +80,11 @@ def summary # @return [Boolean] def import(profile, merge = !Yast::Mode.config) self.class.profile = profile + # It does not need to be merged with current config but could be modified + # by the AutoYaST confirm dialog. + update_service_state(profile) return false if merge && !read(force: false) - # Obtains the default from the control file (settings) if not present. - enable if profile.fetch("enable_firewall", settings.enable_firewall) start if profile.fetch("start_firewall", false) autoyast.import(profile) check_profile_for_errors @@ -241,16 +242,27 @@ def settings ::Installation::SecuritySettings.instance end - # Set that the firewall has to be enabled when writing - def enable - self.class.enable = true + # It sets which should be the firewalld service state according to the profile + # or to the product defaults settings + # + # @param profile [Hash] firewall profile section to be imported + def update_service_state(profile) + return unless self.class.enable.nil? + + state = profile.fetch("enable_firewall", settings.enable_firewall) + + log.info("Firewall should be enabled: #{state}") + if Yast::Mode.auto + state ? settings.enable_firewall! : settings.disable_firewall! + end + state end # Whether the firewalld service has to be enable or disable when writing # # @return [Boolean] true if has to be enabled; false otherwise def enable? - !!self.class.enable + !!(Yast::Mode.auto ? settings.enable_firewall : self.class.enable) end # Set that the firewall has to be started when writing