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

Fix rule parsing

Open 2fa opened this issue 10 months ago • 1 comments

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

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

2fa avatar Apr 05 '24 15:04 2fa