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

(MODULE-11463): Fix rule parsing when iptables chains with '-A' in the name #1210

Merged
merged 2 commits into from
Nov 21, 2024

Conversation

2fa
Copy link
Contributor

@2fa 2fa commented Apr 5, 2024

Summary

This PR fixes a couple of issues, related to iptables-save output parsing:

  1. Double quotes in the comment breaks rule parsing (part after the first " will be ignored)
  2. Rule parser thinks that custom chains with -A in the name (NOMAD-ADMIN, for example) is a start of the rule
  3. Single quotes in the comments generates invalid iptables-save output that will then be processed by the rule parser.
  4. For some parameters iptables-save return multiple spaces between flag and actual value (--nflog--prefix)

Additional Context

I've added additional spec test that will be helpful with iptables-save output parsing in the future.

Related Issues (if any)

#1182
#1170

Checklist

  • 🟢 Spec tests.
  • 🟢 Acceptance tests.
  • Manually verified. (For example puppet apply)

@chrisongthb
Copy link

Nice work! Works in our environment on Ubuntu 22.04 & 20.04 k8s nodes. Thanks!

@span786 span786 changed the title Fix rule parsing (MODULE-11463): Fix rule parsing when iptables chains with '-A' in the name Nov 21, 2024
Copy link
Member

@malikparvez malikparvez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good...

@malikparvez malikparvez merged commit 3e8717d into puppetlabs:main Nov 21, 2024
50 checks passed
@2fa 2fa deleted the fix-rule-parsing branch November 21, 2024 13:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants