Skip to content

Commit

Permalink
Fixed: missing default protocol when using dest_port property
Browse files Browse the repository at this point in the history
Signed-off-by: Joseph Larionov <[email protected]>
  • Loading branch information
decoyjoe committed Jan 27, 2025
1 parent dadb305 commit 18146dd
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ This file is used to list changes made in each version of the firewall cookbook.

## Unreleased

### Fixed

- `firewall_rule` doesn't default protocol to `tcp` when using `dest_port` property.

## 7.0.0 - *2025-01-03*

### Summary
Expand Down
2 changes: 1 addition & 1 deletion resources/firewall_rule_firewalld.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
deny: :drop,
}

protocol_required = property_is_set?(:protocol) || property_is_set?(:port) | property_is_set?(:source_port)
protocol_required = property_is_set?(:protocol) || property_is_set?(:port) | property_is_set?(:dest_port) | property_is_set?(:source_port)
array_property = check_for_port_array_property(new_resource)

if array_property
Expand Down
10 changes: 10 additions & 0 deletions test/fixtures/cookbooks/firewall-test/recipes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,16 @@
command :allow
end

firewall_rule 'dest_port' do
dest_port 25
command :allow
end

firewall_rule 'source_port' do
source_port 31000
command :allow
end

# other rules
firewall_rule 'temp1' do
port 1234
Expand Down

0 comments on commit 18146dd

Please sign in to comment.