Skip to content

Conversation

@waipeng
Copy link

@waipeng waipeng commented Apr 29, 2025

iptables-save does not show any build-in chains when they have not been interacted with. This leads to the chain being (re)-created.

#1206 attempted to fix this, by listing the chain instead of creating it, but this method only seems to work on non-nft iptables (#1217 (comment)).

Fix this for nft version of iptables by setting the policy of the chain instead of listing it. This seems to work for both nft and non-nft version of iptables (tested on Ubuntu 20.04 and 24.04).

Fixes #1217

Summary

Provide a detailed description of all the changes present in this pull request.

Additional Context

Add any additional context about the problem here.

  • Root cause and the steps to reproduce. (If applicable)
  • Thought process behind the implementation.

Related Issues (if any)

Mention any related issues or pull requests.

Checklist

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

`iptables-save` does not show any build-in chains when they have not
been interacted with. This leads to the chain being (re)-created.

PR#1206 attempted to fix this, by listing the chain instead of creating
it, but this method only seems to work on non-nft iptables[1].

Fix this for nft version of iptables by setting the policy of the chain
instead of listing it. This seems to work for both nft and non-nft
version of iptables (tested on Ubuntu 20.04 and 24.04).

Fixes puppetlabs#1217

[1] puppetlabs#1217 (comment)
@waipeng waipeng marked this pull request as ready for review April 29, 2025 16:16
@waipeng waipeng requested a review from a team as a code owner April 29, 2025 16:16
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.

Non idempotent logs for empty firewall chains

1 participant