puppetlabs-firewall icon indicating copy to clipboard operation
puppetlabs-firewall copied to clipboard

fix service port number lookup to use protocol

Open kjetilho opened this issue 4 years ago • 9 comments

The existing code passes :proto, which string_to_port casts to a string, gets "proto", compares that to the possibilities "udp" or "tcp", and when neither, falls back to using "tcp".

This patch passes the actual proto value to the function, in case there is a UDP specific service in your /etc/services (uncommon, but it happens). It looks like Puppet will evaluate the properties in declared order, so I had to move newproperty(:proto) up so @resource[:proto] was available in the code for sport, dport and port.

kjetilho avatar Dec 01 '21 21:12 kjetilho

firewall is a type

that may have no external impact to Forge modules.

This module is declared in 105 of 578 indexed public Puppetfiles.


These results were generated with Rangefinder, a tool that helps predict the downstream impact of breaking changes to elements used in Puppet modules. You can run this on the command line to get a full report.

Exact matches are those that we can positively identify via namespace and the declaring modules' metadata. Non-namespaced items, such as Puppet 3.x functions, will always be reported as near matches only.

Hrm, looks like the test case "'040 partial invert" needs adjustment? It now bombs since "http/udp" does not exist in the test harness (it does exist on my Fedora!). This error was hidden earlier since it looked up "http/tcp".

kjetilho avatar Dec 01 '21 21:12 kjetilho

This PR has been marked as stale because it has been open for a while and has had no recent activity. If this PR is still important to you please drop a comment below and we will add this to our backlog to complete. Otherwise, it will be closed in 7 days.

github-actions[bot] avatar Apr 30 '22 02:04 github-actions[bot]

This bug is still relevant, and the patch still applies cleanly.

kjetilho avatar May 01 '22 22:05 kjetilho

Hi @kjetilho, thanks for letting us know. We are using the stale-bot as a tool to sort our current PRs and figure out which ones are relevant and which ones might be outdated. We will be putting your PR into the active column and, hopefully, we will be able to review it soon. Thanks for your patience.

LukasAud avatar May 02 '22 11:05 LukasAud

Closing and opening to re-kick automated testing.

LukasAud avatar May 16 '22 15:05 LukasAud

firewall is a type

Breaking changes to this file WILL impact these 121 modules (exact match):
Breaking changes to this file MAY impact these 145 modules (near match):

This module is declared in 107 of 579 indexed public Puppetfiles.


These results were generated with Rangefinder, a tool that helps predict the downstream impact of breaking changes to elements used in Puppet modules. You can run this on the command line to get a full report.

Exact matches are those that we can positively identify via namespace and the declaring modules' metadata. Non-namespaced items, such as Puppet 3.x functions, will always be reported as near matches only.

Hi @kjetilho, there seems to be a spec test that is failing currently on your PR. The log is pointing at the following file:

rspec ./spec/unit/puppet/provider/iptables_spec.rb:340 # iptables provider when inverting rules fails when not all array items are inverted

Can you investigate this issue and (if related to your PR) make the necessary changes for the test to pass?

LukasAud avatar May 17 '22 09:05 LukasAud

@kjetilho Any movement on this?

david22swan avatar Jul 04 '22 13:07 david22swan

yep, I can reproduce when testing locally. will fix soon. thanks!

kjetilho avatar Aug 17 '22 15:08 kjetilho

@kjetilho Thanks for this - can you rebase with the current main so we can proceed.

jordanbreen28 avatar Oct 03 '22 12:10 jordanbreen28

not sure if you are notified when I push a rebase, so adding a comment: "sure!" :)

kjetilho avatar Oct 03 '22 21:10 kjetilho