Skip to content

Commit

Permalink
Merge pull request #640 from teclator/export_firewalld
Browse files Browse the repository at this point in the history
SuSEFirewall: Export minimal AY firewalld configuration (bsc#1067193)
  • Loading branch information
teclator committed Nov 17, 2017
2 parents 24e5c7c + 2721b6b commit 7df7012
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 11 deletions.
3 changes: 2 additions & 1 deletion library/network/src/lib/network/susefirewalld.rb
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,8 @@ def sf2_to_firewalld_service(service)
#
# @return [Hash{String => Object}] with configuration
def Export
deep_copy(@SETTINGS)
# FIXME: Temporal export until a new schema is defined for firewalld
@SETTINGS.select { |k, v| KEY_SETTINGS.include?(k) && !v.nil? }
end

# Function for setting SuSEFirewall configuration from input
Expand Down
16 changes: 7 additions & 9 deletions library/network/test/susefirewalld_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,12 @@ def reset_FirewallDIsInstalled_cache
interfaces: ["eth3"]
}
}.freeze

MINIMAL_CONFIG = {
"logging" => "off",
"start_firewall" => true,
"enable_firewall" => true
}.freeze
FULL_FAKE_FIREWALLD_CONFIG = GOOD_FAKE_FIREWALLD_CONFIG.merge(BAD_FAKE_FIREWALLD_CONFIG)

context "when verifying its basic configuration" do
Expand All @@ -171,15 +177,7 @@ def reset_FirewallDIsInstalled_cache
context "given a known configuration" do
it "can import it and export it" do
expect(subject.Import(FULL_FAKE_FIREWALLD_CONFIG)).to be nil
good_config = Yast.deep_copy(GOOD_FAKE_FIREWALLD_CONFIG)
GOOD_FAKE_FIREWALLD_CONFIG.keys.each do |key|
next unless subject.GetKnownFirewallZones().include?(key)
good_config[key] = Yast::SuSEFirewalldClass::EMPTY_ZONE.merge(good_config[key])
# When importing configuration we consider all zone attributes as
# dirty
good_config[key][:modified] = [:interfaces, :masquerade, :ports, :protocols, :services]
end
expect(subject.Export).to include(good_config)
expect(subject.Export).to include(MINIMAL_CONFIG)
end

it "it does not propagate invalid settings to internal data structures" do
Expand Down
7 changes: 7 additions & 0 deletions package/yast2.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
-------------------------------------------------------------------
Thu Nov 16 16:09:43 UTC 2017 - knut.anderssen@suse.com

- SuSEFirewall: Export minimal firewalld configuration until the
AY firewall schema is adapted (bsc#1067193)
- 4.0.15

-------------------------------------------------------------------
Thu Nov 9 09:26:19 UTC 2017 - knut.anderssen@suse.com

Expand Down
2 changes: 1 addition & 1 deletion package/yast2.spec
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@


Name: yast2
Version: 4.0.14
Version: 4.0.15
Release: 0
Summary: YaST2 - Main Package
License: GPL-2.0
Expand Down

0 comments on commit 7df7012

Please sign in to comment.