From a06dadb88fce02d9045b65d501bbbe788006970d Mon Sep 17 00:00:00 2001 From: Josef Reidinger Date: Fri, 1 Sep 2023 22:11:08 +0200 Subject: [PATCH 1/4] Bump version to 4.6.0 --- package/yast2-firewall.changes | 5 +++++ package/yast2-firewall.spec | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/package/yast2-firewall.changes b/package/yast2-firewall.changes index 10b6815..2f01ef8 100644 --- a/package/yast2-firewall.changes +++ b/package/yast2-firewall.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Fri Sep 01 19:57:03 UTC 2023 - Josef Reidinger + +- Branch package for SP6 (bsc#1208913) + ------------------------------------------------------------------- Wed Apr 06 13:24:58 UTC 2022 - Ladislav Slezák diff --git a/package/yast2-firewall.spec b/package/yast2-firewall.spec index ee1609e..c794362 100644 --- a/package/yast2-firewall.spec +++ b/package/yast2-firewall.spec @@ -17,7 +17,7 @@ Name: yast2-firewall -Version: 4.5.0 +Version: 4.6.0 Release: 0 Summary: YaST2 - Firewall Configuration Group: System/YaST From ec9ebcec38041ae7f790c476b8365c4c420a525d Mon Sep 17 00:00:00 2001 From: Knut Anderssen Date: Tue, 31 Oct 2023 16:21:10 +0000 Subject: [PATCH 2/4] Sets the firewalld service state according to the profile --- src/lib/y2firewall/clients/auto.rb | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/src/lib/y2firewall/clients/auto.rb b/src/lib/y2firewall/clients/auto.rb index 631ebbf..b9345aa 100644 --- a/src/lib/y2firewall/clients/auto.rb +++ b/src/lib/y2firewall/clients/auto.rb @@ -79,10 +79,10 @@ 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 @@ -240,16 +240,25 @@ 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}") + state ? settings.enable_firewall! : settings.disable_firewall! if Yast::Mode.auto + 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 From 20f65dccfd9452a1068e1c662f00de1d5a4b1f52 Mon Sep 17 00:00:00 2001 From: Knut Anderssen Date: Tue, 31 Oct 2023 16:45:36 +0000 Subject: [PATCH 3/4] Bump version & changelog --- package/yast2-firewall.changes | 8 ++++++++ package/yast2-firewall.spec | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/package/yast2-firewall.changes b/package/yast2-firewall.changes index 10b6815..e2fcc13 100644 --- a/package/yast2-firewall.changes +++ b/package/yast2-firewall.changes @@ -1,3 +1,11 @@ +------------------------------------------------------------------- +Tue Oct 31 16:42:54 UTC 2023 - Knut Anderssen + +- In case of autoinstallation keep the firewall service state in + the Installation::SecuritySettings for not conflicting with the + proposal (bsc#1216615) +- 4.5.1 + ------------------------------------------------------------------- Wed Apr 06 13:24:58 UTC 2022 - Ladislav Slezák diff --git a/package/yast2-firewall.spec b/package/yast2-firewall.spec index ee1609e..8a2e5e3 100644 --- a/package/yast2-firewall.spec +++ b/package/yast2-firewall.spec @@ -17,7 +17,7 @@ Name: yast2-firewall -Version: 4.5.0 +Version: 4.5.1 Release: 0 Summary: YaST2 - Firewall Configuration Group: System/YaST From 46bd504ed73d3512b11ce6957ffd23edaad86406 Mon Sep 17 00:00:00 2001 From: Knut Anderssen Date: Tue, 31 Oct 2023 17:05:49 +0000 Subject: [PATCH 4/4] Makes rubocop happy --- src/lib/y2firewall/clients/auto.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/lib/y2firewall/clients/auto.rb b/src/lib/y2firewall/clients/auto.rb index b9345aa..a6f3bbe 100644 --- a/src/lib/y2firewall/clients/auto.rb +++ b/src/lib/y2firewall/clients/auto.rb @@ -83,6 +83,7 @@ def import(profile, merge = !Yast::Mode.config) # by the AutoYaST confirm dialog. update_service_state(profile) return false if merge && !read(force: false) + start if profile.fetch("start_firewall", false) autoyast.import(profile) check_profile_for_errors @@ -250,7 +251,9 @@ def update_service_state(profile) state = profile.fetch("enable_firewall", settings.enable_firewall) log.info("Firewall should be enabled: #{state}") - state ? settings.enable_firewall! : settings.disable_firewall! if Yast::Mode.auto + if Yast::Mode.auto + state ? settings.enable_firewall! : settings.disable_firewall! + end state end