Skip to content

Commit

Permalink
Update calls to the firewall module with modern parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
nward committed May 15, 2024
1 parent d1aff2f commit c4d4ad6
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
13 changes: 7 additions & 6 deletions manifests/client.pp
Original file line number Diff line number Diff line change
Expand Up @@ -61,17 +61,18 @@
if $port {
if $ip {
firewall { "100 ${name} ${port_description} v4":
proto => 'udp',
dport => $port,
action => 'accept',
source => $ip,
proto => 'udp',
dport => $port,
jump => 'ACCEPT',
protocol => 'IPv4',
source => $ip,
}
} elsif $ip6 {
firewall { "100 ${name} ${port_description} v6":
proto => 'udp',
dport => $port,
action => 'accept',
provider => 'ip6tables',
jump => 'ACCEPT',
protocol => 'IPv6',
source => $ip6,
}
}
Expand Down
13 changes: 7 additions & 6 deletions spec/defines/client_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,9 @@
is_expected.to contain_firewall('100 test 1234 v4')
.with_proto('udp')
.with_dport(1234)
.with_action('accept')
.with_jump('ACCEPT')
.with_source('1.2.3.4')
.with_protocol('IPv4')
end

context 'with ipv6' do
Expand All @@ -102,9 +103,9 @@
is_expected.to contain_firewall('100 test 1234 v6')
.with_proto('udp')
.with_dport(1234)
.with_action('accept')
.with_jump('ACCEPT')
.with_source('2001:db8::100')
.with_provider('ip6tables')
.with_protocol('IPv6')
end
end
end
Expand All @@ -120,7 +121,7 @@
is_expected.to contain_firewall('100 test 1234,4321 v4')
.with_proto('udp')
.with_dport([1234, 4321])
.with_action('accept')
.with_jump('ACCEPT')
.with_source('1.2.3.4')
end

Expand All @@ -137,9 +138,9 @@
is_expected.to contain_firewall('100 test 1234,4321 v6')
.with_proto('udp')
.with_dport([1234, 4321])
.with_action('accept')
.with_jump('ACCEPT')
.with_source('2001:db8::100')
.with_provider('ip6tables')
.with_protocol('IPv6')
end
end
end
Expand Down

0 comments on commit c4d4ad6

Please sign in to comment.