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

Fix rule parsing #1210

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Fix rule parsing #1210

wants to merge 1 commit into from

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants