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

add support for using rpfilter in rules

Open cmusik opened this issue 2 years ago • 14 comments

When rules with rpfilter are used, then there are warnings like these in the output:

Warning: Puppet::Type::Firewall::ProviderIptables: Skipping unparsable iptables rule: keys (5) and values (6) count mismatch on line: -A cali-PREROUTING -m comment --comment "cali:mPIOOWmbH3iO0R90" -m mark --mark 0x40000/0x40000 -m rpfilter --validmark --invert -j DROP

cmusik avatar Jul 18 '22 13:07 cmusik

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Jul 18 '22 13:07 CLAassistant

Hello! 👋

This pull request has been open for a while and has had no recent activity. We've labelled it with attention-needed so that we can get a clear view of which PRs need our attention.

If you are waiting on a response from us we will try and address your comments on a future Community Day.

Alternatively, if it is no longer relevant to you please close the PR with a comment.

Please note that if a pull request receives no update for 7 after it has been labelled, it will be closed. We are always happy to re-open pull request if they have been closed in error.

github-actions[bot] avatar Sep 17 '22 02:09 github-actions[bot]

I have updated the code so that the tests should run fine now

cmusik avatar Sep 19 '22 09:09 cmusik

@cmusik Look's like you've got a bunch of syntax errors. The only test failure I see looks to be transient though.

david22swan avatar Sep 21 '22 09:09 david22swan

@david22swan I have fixed them and now there should be no syntax problem

cmusik avatar Sep 21 '22 09:09 cmusik

@cmusik While this looks good to me on a first glance I would prefer that it have at least one test to cover the new functionality.

david22swan avatar Sep 21 '22 10:09 david22swan

right now the rpfilter option allows you only to specify one argument so this fix here is to parse it correctly if there are more arguments set. We have applications which are creating rpfilter rules with more then one argument and this leads to this warning specified in the description. So I'm not sure how to test it without fixing the other problem (right now I'm struggling with this).

cmusik avatar Sep 22 '22 13:09 cmusik

Ok, I have found the missing steps and updated the PR. Now I still need to add a test case for the new functionality.

cmusik avatar Sep 23 '22 07:09 cmusik

@cmusik has there been any update with adding a test for the new functionality?

jordanbreen28 avatar Oct 03 '22 09:10 jordanbreen28

@jordanbreen28 is there any guide how to implement and running the acceptance tests? I have worked a lot with pdk and unit tests but struggling with the acceptance tests

cmusik avatar Oct 12 '22 08:10 cmusik

Hi @cmusik - you can test modules using Litmus, check out our Litmus documentation here.

jordanbreen28 avatar Oct 12 '22 08:10 jordanbreen28

Hi @jordanbreen28, I have finally managed to get the acceptance to run and extended them for the rpfilter feature

cmusik avatar Oct 14 '22 12:10 cmusik

@cmusik Thank you for all your work on this! It seems that the spec tests are failing with

manifests/linux/debian.pp - ERROR: there should be a single space before an opening brace on line 37 (check: manifest_whitespace_opening_brace_before).

We are aware of this and are working to rectify, it is unrelated to this PR.

Please rebase with the current main so we can proceed.

P.s. we are also aware of the PR testing failures for this module and they are unrelated to this PR. :-)

jordanbreen28 avatar Oct 14 '22 12:10 jordanbreen28

@jordanbreen28 I have rebased the branch. And yes - I have already noticed that the tests are failing. I had also some problems with litmus tests from the main branch.

cmusik avatar Oct 14 '22 12:10 cmusik

@cmusik Look's like you've just got a simple syntax failure here:

manifests/linux/debian.pp - ERROR: there should be a single space before an opening brace on line 37 (check: manifest_whitespace_opening_brace_before)

david22swan avatar Oct 31 '22 10:10 david22swan

@david22swan this problem was not introduced by me and was fixed a few days ago in the puppetlabs main branch. I have rebased again and it should work now

cmusik avatar Oct 31 '22 11:10 cmusik

I have somehow missed one rubocop warning. This is fixed now and hopefully this was the last problem with this PR :)

cmusik avatar Nov 04 '22 12:11 cmusik

Hi @cmusik - Apologies for the wait with this one, can you rebase with the current main and I will work on getting this merged in! :-)

jordanbreen28 avatar Nov 21 '22 14:11 jordanbreen28

Hi @jordanbreen28, I have rebased it again.

cmusik avatar Nov 21 '22 14:11 cmusik

@cmusik great! Once tests have completed and are green I'll merge in. Thanks for your work on this one.

jordanbreen28 avatar Nov 21 '22 14:11 jordanbreen28