Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent duplicate declaration in firewalld_ipset #50

Merged
merged 1 commit into from
May 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
* Mon Apr 29 2024 Steven Pritchard <[email protected]> - 0.10.1
- Prevent duplicate declaration in `firewalld_ipset` (#49)

* Thu Jan 18 2024 Mike Riddle <[email protected]> - 0.10.0
- Made the 99_simp zone purge parameters toggle-able

Expand Down
2 changes: 1 addition & 1 deletion manifests/rule.pp
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@
'simp',
seeded_rand_string(
26,
join([$_ipset_family, $_ipset_type] + sort(unique($_trusted_nets)),'')
join([$_ipset_family, $_ipset_type] + sort(unique($_trusted_nets)) + $_ipset_entries,'')
)
], '-')[0,31]

Expand Down
2 changes: 1 addition & 1 deletion metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "simp-simp_firewalld",
"version": "0.10.0",
"version": "0.10.1",
"author": "SIMP Team",
"summary": "SIMP-oriented firewalld management",
"license": "Apache-2.0",
Expand Down
8 changes: 4 additions & 4 deletions spec/acceptance/suites/default/00_default_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ class { 'simp_firewalld': enable => true }

expect(target_ruleset.size).to eq(2)

hash_ip_ipset = 'simp-gEi0qMBFhbv6eiaWYmkwap62GS'
hash_net_ipset = 'simp-j07oVIg3S8ccSfyQGfBvCdqsCv'
hash_ip_ipset = 'simp-P2bfsoqkagK6KYomH5dgJFNq6i'
hash_net_ipset = 'simp-tn9HkuMIqysMB38yE39eTr1BDA'

expect(target_ruleset).to include(match(%r{ipset="#{hash_ip_ipset}"}))
expect(target_ruleset).to include(match(%r{ipset="#{hash_net_ipset}"}))
Expand Down Expand Up @@ -132,8 +132,8 @@ class { 'simp_firewalld': enable => true }

expect(target_ruleset.size).to eq(2)

hash_ip_ipset = 'simp-BahW5mYEj6huIkJdFkE4gS68zH'
hash_net_ipset = 'simp-ijfIJaYoC8b8MC3CPSwRFKY6h9'
hash_ip_ipset = 'simp-O9NSV0JsGTTti0eoSoRle4FzWr'
hash_net_ipset = 'simp-c53N50IHUI62MAHDArAdokw4kI'

expect(target_ruleset).to include(match(%r{ipset="#{hash_ip_ipset}"}))
expect(target_ruleset).to include(match(%r{ipset="#{hash_net_ipset}"}))
Expand Down
16 changes: 8 additions & 8 deletions spec/defines/rule/ah_esp_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@
it { is_expected.to create_simp_firewalld__rule(title) }

it {
is_expected.to create_firewalld_rich_rule("simp_15_#{title}_simp-sLxKcJ8Jr7GgDOF54KlBvQR2Yc").with(
is_expected.to create_firewalld_rich_rule("simp_15_#{title}_simp-CmxLn8c8yuIQ2VyzgvzR4yi8TS").with(
{
:ensure => 'present',
:family => 'ipv4',
:source => { 'ipset' => 'simp-sLxKcJ8Jr7GgDOF54KlBvQR2Yc' },
:source => { 'ipset' => 'simp-CmxLn8c8yuIQ2VyzgvzR4yi8TS' },
:action => 'accept',
:zone => '99_simp',
:protocol => 'ah',
Expand All @@ -51,11 +51,11 @@
}

it {
is_expected.to create_firewalld_rich_rule("simp_15_#{title}_simp-l7zVcqWPK6oo3saymLCPHgjuhp").with(
is_expected.to create_firewalld_rich_rule("simp_15_#{title}_simp-07jxibAQvZRtfJna9ZG6dLvz2e").with(
{
:ensure => 'present',
:family => 'ipv6',
:source => {'ipset' => 'simp-l7zVcqWPK6oo3saymLCPHgjuhp'},
:source => {'ipset' => 'simp-07jxibAQvZRtfJna9ZG6dLvz2e'},
:action => 'accept',
:zone => '99_simp',
:protocol => 'ah',
Expand All @@ -74,11 +74,11 @@
it { is_expected.to create_simp_firewalld__rule(title) }

it {
is_expected.to create_firewalld_rich_rule("simp_15_#{title}_simp-sLxKcJ8Jr7GgDOF54KlBvQR2Yc").with(
is_expected.to create_firewalld_rich_rule("simp_15_#{title}_simp-CmxLn8c8yuIQ2VyzgvzR4yi8TS").with(
{
:ensure => 'present',
:family => 'ipv4',
:source => { 'ipset' => 'simp-sLxKcJ8Jr7GgDOF54KlBvQR2Yc' },
:source => { 'ipset' => 'simp-CmxLn8c8yuIQ2VyzgvzR4yi8TS' },
:action => 'accept',
:zone => '99_simp',
:protocol => 'esp',
Expand All @@ -87,11 +87,11 @@
}

it {
is_expected.to create_firewalld_rich_rule("simp_15_#{title}_simp-l7zVcqWPK6oo3saymLCPHgjuhp").with(
is_expected.to create_firewalld_rich_rule("simp_15_#{title}_simp-07jxibAQvZRtfJna9ZG6dLvz2e").with(
{
:ensure => 'present',
:family => 'ipv6',
:source => {'ipset' => 'simp-l7zVcqWPK6oo3saymLCPHgjuhp'},
:source => {'ipset' => 'simp-07jxibAQvZRtfJna9ZG6dLvz2e'},
:action => 'accept',
:zone => '99_simp',
:protocol => 'esp',
Expand Down
16 changes: 8 additions & 8 deletions spec/defines/rule/all_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,10 @@

it { is_expected.not_to create_firewalld__custom_service("simp_all_#{title}") }
it { is_expected.not_to create_firewalld_service("simp_all_#{title}") }
it { is_expected.not_to create_firewalld_ipset('simp-YBi8gcbxcIq0JuB3tmmajXBuPA') }
it { is_expected.not_to create_firewalld_ipset('simp-Z4NZ2BaANQcFilLyb0EOS098rm') }
it { is_expected.not_to create_firewalld_ipset('simp-JLn9X7BmpTacRGDKNCKSeIJhbZ') }
it { is_expected.not_to create_firewalld_ipset('simp-siFVMk3fjxaKSgTnYmVONaUP7g') }
it {
is_expected.to create_firewalld_rich_rule("simp_11_#{title}_simp-YBi8gcbxcIq0JuB3tmmajXBuPA").with(
is_expected.to create_firewalld_rich_rule("simp_11_#{title}_simp-JLn9X7BmpTacRGDKNCKSeIJhbZ").with(
{
:ensure => 'present',
:family => 'ipv4',
Expand All @@ -92,7 +92,7 @@
)
}
it {
is_expected.to create_firewalld_rich_rule("simp_11_#{title}_simp-Z4NZ2BaANQcFilLyb0EOS098rm").with(
is_expected.to create_firewalld_rich_rule("simp_11_#{title}_simp-siFVMk3fjxaKSgTnYmVONaUP7g").with(
{
:ensure => 'present',
:family => 'ipv6',
Expand All @@ -116,7 +116,7 @@
}}

it {
is_expected.to create_firewalld_rich_rule("simp_11_#{title}_simp-YBi8gcbxcIq0JuB3tmmajXBuPA").with(
is_expected.to create_firewalld_rich_rule("simp_11_#{title}_simp-JLn9X7BmpTacRGDKNCKSeIJhbZ").with(
{
:ensure => 'present',
:family => 'ipv4',
Expand All @@ -129,7 +129,7 @@
)
}

it { is_expected.not_to create_firewalld_rich_rule("simp_11_#{title}_simp-Z4NZ2BaANQcFilLyb0EOS098rm") }
it { is_expected.not_to create_firewalld_rich_rule("simp_11_#{title}_simp-siFVMk3fjxaKSgTnYmVONaUP7g") }
end

context 'IPv6 only' do
Expand All @@ -142,7 +142,7 @@
}}

it {
is_expected.not_to create_firewalld_rich_rule("simp_11_#{title}_simp-Z4NZ2BaANQcFilLyb0EOS098rm").with(
is_expected.not_to create_firewalld_rich_rule("simp_11_#{title}_simp-siFVMk3fjxaKSgTnYmVONaUP7g").with(
{
:ensure => 'present',
:family => 'ipv6',
Expand All @@ -155,7 +155,7 @@
)
}

it { is_expected.not_to create_firewalld_rich_rule("simp_11_#{title}_simp-YBi8gcbxcIq0JuB3tmmajXBuPA") }
it { is_expected.not_to create_firewalld_rich_rule("simp_11_#{title}_simp-JLn9X7BmpTacRGDKNCKSeIJhbZ") }
end

context 'IPv4 mismatched application' do
Expand Down
8 changes: 4 additions & 4 deletions spec/defines/rule/icmp_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,25 +38,25 @@
it { is_expected.to create_simp_firewalld__rule(title) }

it {
is_expected.to create_firewalld_rich_rule("simp_11_#{title}_simp-sLxKcJ8Jr7GgDOF54KlBvQR2Yc").with(
is_expected.to create_firewalld_rich_rule("simp_11_#{title}_simp-CmxLn8c8yuIQ2VyzgvzR4yi8TS").with(
{
:ensure => 'present',
:family => 'ipv4',
:icmp_block => ['8'],
:source => { 'ipset' => 'simp-sLxKcJ8Jr7GgDOF54KlBvQR2Yc' },
:source => { 'ipset' => 'simp-CmxLn8c8yuIQ2VyzgvzR4yi8TS' },
:action => 'accept',
:zone => '99_simp'
}
)
}

it {
is_expected.to create_firewalld_rich_rule("simp_11_#{title}_simp-l7zVcqWPK6oo3saymLCPHgjuhp").with(
is_expected.to create_firewalld_rich_rule("simp_11_#{title}_simp-07jxibAQvZRtfJna9ZG6dLvz2e").with(
{
:ensure => 'present',
:family => 'ipv6',
:icmp_block => ['8'],
:source => {'ipset' => 'simp-l7zVcqWPK6oo3saymLCPHgjuhp'},
:source => {'ipset' => 'simp-07jxibAQvZRtfJna9ZG6dLvz2e'},
:action => 'accept',
:zone => '99_simp'
}
Expand Down
8 changes: 4 additions & 4 deletions spec/defines/rule/tcp_stateful_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@
it { is_expected.to create_simp_firewalld__rule(title).with_dports(params[:dports]) }

it {
is_expected.to create_firewalld_rich_rule("simp_11_#{title}_simp-sLxKcJ8Jr7GgDOF54KlBvQR2Yc").with(
is_expected.to create_firewalld_rich_rule("simp_11_#{title}_simp-CmxLn8c8yuIQ2VyzgvzR4yi8TS").with(
{
:ensure => 'present',
:family => 'ipv4',
:source => { 'ipset' => 'simp-sLxKcJ8Jr7GgDOF54KlBvQR2Yc' },
:source => { 'ipset' => 'simp-CmxLn8c8yuIQ2VyzgvzR4yi8TS' },
:service => "simp_#{title}",
:action => 'accept',
:zone => '99_simp'
Expand All @@ -52,11 +52,11 @@
}

it {
is_expected.to create_firewalld_rich_rule("simp_11_#{title}_simp-l7zVcqWPK6oo3saymLCPHgjuhp").with(
is_expected.to create_firewalld_rich_rule("simp_11_#{title}_simp-07jxibAQvZRtfJna9ZG6dLvz2e").with(
{
:ensure => 'present',
:family => 'ipv6',
:source => {'ipset' => 'simp-l7zVcqWPK6oo3saymLCPHgjuhp'},
:source => {'ipset' => 'simp-07jxibAQvZRtfJna9ZG6dLvz2e'},
:service => "simp_#{title}",
:action => 'accept',
:zone => '99_simp'
Expand Down
8 changes: 4 additions & 4 deletions spec/defines/rule/udp_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@
it { is_expected.to create_simp_firewalld__rule(title).with_dports(params[:dports]) }

it {
is_expected.to create_firewalld_rich_rule("simp_11_#{title}_simp-sLxKcJ8Jr7GgDOF54KlBvQR2Yc").with(
is_expected.to create_firewalld_rich_rule("simp_11_#{title}_simp-CmxLn8c8yuIQ2VyzgvzR4yi8TS").with(
{
:ensure => 'present',
:family => 'ipv4',
:source => { 'ipset' => 'simp-sLxKcJ8Jr7GgDOF54KlBvQR2Yc' },
:source => { 'ipset' => 'simp-CmxLn8c8yuIQ2VyzgvzR4yi8TS' },
:service => "simp_#{title}",
:action => 'accept',
:zone => '99_simp'
Expand All @@ -52,11 +52,11 @@
}

it {
is_expected.to create_firewalld_rich_rule("simp_11_#{title}_simp-l7zVcqWPK6oo3saymLCPHgjuhp").with(
is_expected.to create_firewalld_rich_rule("simp_11_#{title}_simp-07jxibAQvZRtfJna9ZG6dLvz2e").with(
{
:ensure => 'present',
:family => 'ipv6',
:source => {'ipset' => 'simp-l7zVcqWPK6oo3saymLCPHgjuhp'},
:source => {'ipset' => 'simp-07jxibAQvZRtfJna9ZG6dLvz2e'},
:service => "simp_#{title}",
:action => 'accept',
:zone => '99_simp'
Expand Down
Loading